with-random ( rnd quot -- ) (original) (raw)

with-random ( rnd quot -- )
Generating random integers

Prev: random-32 ( -- n )
Next: with-system-random ( quot -- )

Vocabulary
random

Inputs

rnd a random number generator
quot a quotation

Outputs
None

Word description
Calls the quotation with the random number generator in a dynamic variable. All random numbers will be generated using this random number generator.

See also
with-secure-random, with-system-random

Definition

USING: kernel namespaces ;

IN: random

: with-random ( rnd quot -- )
random-generator swap with-variable ; inline