Befunge RNG -- Why am I getting so many 2s?

91 views Asked by At

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?

1

There are 1 answers

0
flytzen On BEST ANSWER

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.