Skip to content

library__random

Robert Bossy edited this page Jul 27, 2017 · 1 revision

#random

Synopsis

Pseudo-random number generator.

Functons

random:gaussian()

Generates a random double. The returned value behaves like a random variable with mean 0.0 and standard deviation 1.0.

random:init(seed)

Initializes the current RNG with the specified seed evaluated as a double.

random:init()

Initializes the current RNG with a seed generated from the internal clock. The value of the seed is returned.

random:next()

Generates a random integer, double or boolean according to the context.

random:next(max)

Evaluates max as an integer and generates a random integer, double or boolean according to the context. If this function must return an integer, then the result is between 0 (inclusive) and max (exclusive).

random:seed()

Returns the seed of the current RNG.

random:shuffle(it)

Evaluates it as a list of elements, and returns this list randomly shuffled.

Clone this wiki locally