Randomness

RNG Functions

rand

Returns a random float between 0 (inclusive) and 1 (exclusive).

randi

Returns a random integer that is either 0 or 1.

rand_range from to

Returns a random float between from (inclusive) and to (exclusive).

rand_rangei from to

Returns a random float between from (inclusive) and to (inclusive).

randi_range from to

Returns a random integer between from (inclusive) and to (exclusive).

randi_rangei from to

Returns a random integer between from (inclusive) and to (inclusive).

List Functions

shuffle list

Returns a new list with the elements of list randomly rearranged.

Example:

randomized_list = shuffle [1, 2, 3]

choose list

Returns a randomly selected element from list.

Example:

random_number = choose [1, 2, 3]

Noise Functions

noise1 n

Generates a noise value based on the input parameter n. Accepts integer and float types.

Example:

noise_value = noise1 1.0

noise2 n1 n2

Generates a noise value based on two input parameters n1 and n2. Accepts integer and float types.

Example:

noise_value = noise2 1.0 2.0

noise3 n1 n2 n3

Generates a noise value based on three input parameters n1, n2, and n3. Accepts integer and float types.

Example:

noise_value = noise3 1.0 2.0 3.0

noise4 n1 n2 n3 n4

Generates a noise value based on four input parameters n1, n2, n3, and n4. Accepts integer and float types.

Example:

noise_value = noise4 1.0 2.0 3.0 4.0

Last updated