Set random seed for cirq functions

112 Views Asked by At

I am working with cirq and use a random unitary for testing purposes with:

random_matrix = cirq.testing.random_unitary(dim=4)

where can can the random seed for this function be set, using random.seed(a=1) does not seem to do this.

1

There are 1 best solutions below

1
On BEST ANSWER

Cirq relies on numpy for its random functions, so using:

np.random.seed(2)

Sets the seed for cirq