— Function: **random**` n state`

— Function:**random**` n`

— Function:

nmust be an exact positive integer.`random`

returns an exact integer between zero (inclusive) andn(exclusive). The values returned by`random`

are uniformly distributed from 0 ton.The optional argument

statemust be of the type returned by`(seed->random-state)`

or`(make-random-state)`

. It defaults to the value of the variable`*random-state*`

. This object is used to maintain the state of the pseudo-random-number generator and is altered as a side effect of calls to`random`

.

— Variable: ***random-state***

Holds a data structure that encodes the internal state of the random-number generator that

`random`

uses by default. The nature of this data structure is implementation-dependent. It may be printed out and successfully read back in, but may or may not function correctly as a random-number state object in another implementation.

— Function: **seed->random-state**` seed`

Returns a new object of type suitable for use as the value of the variable

`*random-state*`

or as a second argument to`random`

. The number or stringseedis used to initialize the state. If`seed->random-state`

is called twice with arguments which are`equal?`

, then the returned data structures will be`equal?`

. Calling`seed->random-state`

with unequal arguments will nearly always return unequal states.

— Function: **make-random-state**

— Function:**make-random-state**` obj`

— Function:

Returns a new object of type suitable for use as the value of the variable

`*random-state*`

or as a second argument to`random`

. If the optional argumentobjis given, it should be a printable Scheme object; the first 50 characters of its printed representation will be used as the seed. Otherwise the value of`*random-state*`

is used as the seed.