RNG

class guppylang.std.qsystem.random.RNG[source]

Random number generator.

static __new__(seed: int) RNG[source]

Create a new random number generator using a seed.

discard() None[source]

Discard the random number generator.

random_angle() angle[source]

Generate a random angle in the range \([-\pi, \pi)\).

random_clifford_angle() angle[source]

Generate a random Clifford angle (multiple of \(\pi/2\)).

random_float() float[source]

Generate a random floating point value in the range [0,1).

random_int() int[source]

Generate a random 32-bit signed integer.

random_int_bounded(bound: int) int[source]

Generate a random 32-bit integer in the range [0, bound).

Args:

bound: The upper bound of the range, needs to less than 2^31.

shuffle(array: array[SHUFFLE_T, SHUFFLE_N]) None[source]

Randomly shuffle the elements of a possibly linear array in place. Uses the Fisher-Yates algorithm.