Skip to content

random

Supported functions in the Python standard library random module.

choice(seq: ArrayLike[T]) -> T

Return a randomly selected element from a non-empty sequence.

The sequence must be array-like, such as an Array or VarArray. Tuples are not supported.

Parameters:

Name Type Description Default
seq ArrayLike[T]

The sequence to choose from.

required

randint(a: int, b: int) -> int

Return a random integer N such that a <= N <= b.

Parameters:

Name Type Description Default
a int

The lower bound.

required
b int

The upper bound.

required

random() -> float

Return a random floating point number in the range [0.0, 1.0).

randrange(start: int, stop: int = ..., step: int = ...) -> int

randrange(stop: int) -> int
randrange(start: int, stop: int, step: int = ...) -> int

Return a randomly selected element from range(start, stop, step).

Parameters:

Name Type Description Default
start int

The start of the range.

required
stop int

The end of the range.

...
step int

The step size.

...

shuffle(seq: ArrayLike[T]) -> None

Shuffle the sequence in place.

The sequence must be a mutable array-like, such as an Array or VarArray.

Parameters:

Name Type Description Default
seq ArrayLike[T]

The sequence to shuffle.

required

uniform(a: float, b: float) -> float

Return a random floating point number between a and b, inclusive.

Parameters:

Name Type Description Default
a float

One endpoint of the range.

required
b float

The other endpoint of the range.

required