donotturnoff

random

random provides support for pseudo-random number generation in Rex.

Pseudo-random number generation functions

random

& random -> num : random
random = random.random()

This generates a random floating-point number on the interval [0, 1), using Python's random module's random function.

randint

$ randint int int -> int
randint min max =
    | error rangeErr "Minimum must be less than or equal to maximum" if > min max
    | int + * + - max min 1 random min

This generates a random integer on the interval [min, max], and throws a rangeErr if min > max.