TruWorlds

Random

Accessed via random

The random module provides a psuedo-random number generator.

Properties

random.current_seed int read-only

The current seed of the random number generator. This seed is unique to the current script environment and is not shared across scripts.

Functions

random.seed(seed: int)

Sets the seed for the random number generator. The random number generator will always produce the same sequence of numbers for a given seed. If you want to produce a different sequence of numbers each time, you can use the random_seed function to set the seed to a random value.

random.random_seed()

Sets the seed for the random number generator to a random value. The seed that is generated using a combination of the current time and other system-level factors to ensure that it is unique for each script environment.

random.range(minInclusive: int, maxInclusive: int) Returns int

Returns a random integer number between 0 (inclusive) and the specified maximum (inclusive).

random.drange(minInclusive: double, maxInclusive: double) Returns double

Decimal range. Returns a random decimal number between 0 (inclusive) and the specified maximum (inclusive).

random.decimal() Returns double

Returns a random decimal number that is greater than or equal to 0 and less than 1.