Next: Floating Point, Previous: Numeric comparison, Up: Arithmetic [Contents][Index]
The pseudo-random number generator is initialised based on the time, so in the usual case it will start at a different value in different sessions.
rnd ( – x ) gforth
x is a random number, with all bits randomly set.
random ( u1 – u2 ) gforth
U2 is a random number 0<=u2<u1.
seed! ( x – ) gforth “seed-store”
Set seed for rnd and random to a specific
value, resulting in a deterministic sequence.