Question

Befunge isn't used much outside of code golf, but I wanted to try to learn it. I got a random number generator from Wikipedia and decided to modify it so that it ended. Here's what I have:

v>>>>.v>
      ?^
 12345@
 ^ ^  
> ? ?^
 v?v  
v6789>

And I was wondering why it has a tendency to generate the number 2 a lot, usually repeated. Is it just the interpreter?

Was it helpful?

Solution

You are missing a question mark on line 4, underneath "2".
Your code starts by going to line 5 and then hit the question mark there. If the question mark goes "up" in your sample, it will allways hit "2", so that will happen 25% of the time.
If you add the missing question mark underneath the number 2 you should start seeing more random results.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top