vendredi 26 juin 2015

Generating a random number in Befunge

I want to generate a random number in Befunge, from 0 to n, where n is an arbitrary number. How would I go about doing this?
I thought of trying this (this example has 2 chained chunks of code to show how it works):

v  v
?#>?#>
1  1
+  +
> ^> ^

and repeating as needed, but I would need n copies of that chunk of code. Is there a better way I can generate a random number like rand(0, 10) in other languages?




Aucun commentaire:

Enregistrer un commentaire