Skip to content

Random numbers

qm.qua.lib.Random

A class for generating pseudo-random numbers in QUA

PARAMETER DESCRIPTION
seed

Optional. An integer / QUA integer seed for the pseudo-random number generator.

TYPE: Optional[Scalar[int]] DEFAULT: None

rand_fixed

Returns a pseudorandom fixed in range [0.0, 1.0)

:Example: >>> a = Random() >>> assign(b, a.rand_fixed())

rand_int

Returns a pseudorandom integer in range [0, max_int)

PARAMETER DESCRIPTION
max_int

maximum value

TYPE: Scalar[int]

:Example: >>> a = Random() >>> assign(b, a.rand_int(max_int))

set_seed

Set the seed for the pseudo-random number generator

PARAMETER DESCRIPTION
exp

a QUA expression

TYPE: Scalar[int]