\ random.f
\ Simple random number generator
\ from Leo Brodie, _Starting Forth_

variable rnd  \ Holds current result

\ Generate a random integer
: random  ( -- u )  rnd @  31421 * 6927 +  dup rnd ! ;

\ Return a randm integer between 0 and u-1
: choose  ( u -- 0...u-1 )  random um* nip ;

\ Initialize
: randomize  ( -- )  time&date + + + + + rnd ! ;