Handbook
Glossary
Generating random integers
The
random
vocabulary contains a protocol for generating random or pseudorandom numbers.
The "Mersenne Twister" pseudorandom number generator algorithm is the default generator stored in
random-generator
.
Generate random object(s):
random
( obj -- elt )
randoms
( length obj -- seq )
Efficient 32-bit random numbers:
random-32
( -- n )
Combinators to change the random number generator:
with-random
( rnd quot -- )
with-system-random
( quot -- )
with-secure-random
( quot -- )
Implementation:
Random protocol
Randomizing a sequence:
randomize
( seq -- randomized )
Sampling a sequences:
sample
( seq n -- seq' )
Deleting a random element from a sequence:
delete-random
( seq -- elt )
Sequences of random numbers:
random-bytes
( n -- byte-array )
random-units
( length -- sequence )
Random numbers with
n
bits:
random-bits
( numbits -- n )
random-bits-exact
( numbits -- n )