Warning

You're browsing the old v2.x documentation. This version is no longer maintained. Click here to go the v3.x documentation.

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
Last revisionBoth sides next revision
rnd [2019/05/07 21:59] – created neilsrnd [2021/01/18 11:35] neils
Line 10: Line 10:
   * an integer between -32768 and +32767   * an integer between -32768 and +32767
   * a float between 0 and 1   * a float between 0 and 1
 +
 +Example:
 +
 +  print "we'll flip a coin"
 +  if rnd() < 0 then print "heads" else print "tails"
 +
 +The pseudo-random number generator is seeded with the software jiffy clock value on program startup.
 +
 +**Note for VICE users**: if you run your program using autorun, the jiffy value will be the same every time you run your program and therefore random sequences will always be the same. You can improve this a little bit by setting the VICE option AutostartDelayRandom, but the best option is to manually load your program, just like a user would on a real machine.