Atom

random.int()

Samples the half-open interval.

Signature

random.int(low, high)

Parameters

Increasing signed integer bounds.

Returns

i64 in [low, high).

Behavior

Advances the PRNG as needed for unbiased bounded sampling.

Errors

Invalid bounds or types.

Example

Atom
use random
n = random.int(-2, 2)
assert(n >= -2 and n < 2)