snakia.random.random

Functions

abstractmethod(funcobj)

A decorator indicating abstract methods.

final(f)

A decorator to indicate final methods and final classes.

Classes

ABC()

Helper class that provides a standard way to create an ABC using inheritance.

Generic()

Abstract base class for generic types.

Random()

A random number generator.

TypeVar(name, *constraints[, bound, ...])

Type variable.

class snakia.random.random.Random[source]

Bases: ABC, Generic[S]

A random number generator.

final below(n)[source]

Return a random int in the range [0,n). Defined for n > 0.

Return type:

int

abstract bits(k)[source]

Return k random bits.

Return type:

int

final bytes(n)[source]

Return n random bytes.

Return type:

bytes

final choice(seq)[source]

Return a random element from a non-empty sequence.

Return type:

TypeVar(T)

final float()[source]

Return a random float in the range [0.0, 1.0).

Return type:

float

abstract get_state()[source]

Get the state of the random number generator.

Return type:

TypeVar(S)

final int(start, end)[source]

Return a random int in the range [start, end].

Return type:

int

abstract set_state(value)[source]

Set the state of the random number generator.

Return type:

None

final shuffle(seq)[source]

Shuffle a sequence in place.

Return type:

TypeVar(M, bound= MutableSequence[Any])