@@ -184,7 +184,7 @@ def random_rotations_between_two_qubit_circuit(
184
184
q1 : 'cirq.Qid' ,
185
185
depth : int ,
186
186
two_qubit_op_factory : Callable [
187
- ['cirq.Qid' , 'cirq.Qid' , 'np.random.RandomState ' ], 'cirq.OP_TREE'
187
+ ['cirq.Qid' , 'cirq.Qid' , 'np.random.Generator ' ], 'cirq.OP_TREE'
188
188
] = lambda a , b , _ : ops .CZPowGate ()(a , b ),
189
189
single_qubit_gates : Sequence ['cirq.Gate' ] = (
190
190
ops .X ** 0.5 ,
@@ -354,7 +354,7 @@ def _get_random_combinations(
354
354
355
355
combinations_by_layer = []
356
356
for pairs , layer in pair_gen :
357
- combinations = rs .randint (0 , n_library_circuits , size = (n_combinations , len (pairs )))
357
+ combinations = rs .integers (0 , n_library_circuits , size = (n_combinations , len (pairs )))
358
358
combinations_by_layer .append (
359
359
CircuitLibraryCombination (layer = layer , combinations = combinations , pairs = pairs )
360
360
)
@@ -553,7 +553,7 @@ def random_rotations_between_grid_interaction_layers_circuit(
553
553
depth : int ,
554
554
* , # forces keyword arguments
555
555
two_qubit_op_factory : Callable [
556
- ['cirq.GridQubit' , 'cirq.GridQubit' , 'np.random.RandomState ' ], 'cirq.OP_TREE'
556
+ ['cirq.GridQubit' , 'cirq.GridQubit' , 'np.random.Generator ' ], 'cirq.OP_TREE'
557
557
] = lambda a , b , _ : ops .CZPowGate ()(a , b ),
558
558
pattern : Sequence [GridInteractionLayer ] = GRID_STAGGERED_PATTERN ,
559
559
single_qubit_gates : Sequence ['cirq.Gate' ] = (
@@ -641,7 +641,7 @@ def __init__(
641
641
self ,
642
642
qubits : Sequence ['cirq.Qid' ],
643
643
single_qubit_gates : Sequence ['cirq.Gate' ],
644
- prng : 'np.random.RandomState ' ,
644
+ prng : 'np.random.Generator ' ,
645
645
) -> None :
646
646
self .qubits = qubits
647
647
self .single_qubit_gates = single_qubit_gates
@@ -651,9 +651,9 @@ def new_layer(self, previous_single_qubit_layer: 'cirq.Moment') -> 'cirq.Moment'
651
651
def random_gate (qubit : 'cirq.Qid' ) -> 'cirq.Gate' :
652
652
excluded_op = previous_single_qubit_layer .operation_at (qubit )
653
653
excluded_gate = excluded_op .gate if excluded_op is not None else None
654
- g = self .single_qubit_gates [self .prng .randint (0 , len (self .single_qubit_gates ))]
654
+ g = self .single_qubit_gates [self .prng .integers (0 , len (self .single_qubit_gates ))]
655
655
while g is excluded_gate :
656
- g = self .single_qubit_gates [self .prng .randint (0 , len (self .single_qubit_gates ))]
656
+ g = self .single_qubit_gates [self .prng .integers (0 , len (self .single_qubit_gates ))]
657
657
return g
658
658
659
659
return circuits .Moment (random_gate (q ).on (q ) for q in self .qubits )
@@ -673,7 +673,7 @@ def new_layer(self, previous_single_qubit_layer: 'cirq.Moment') -> 'cirq.Moment'
673
673
def _single_qubit_gates_arg_to_factory (
674
674
single_qubit_gates : Sequence ['cirq.Gate' ],
675
675
qubits : Sequence ['cirq.Qid' ],
676
- prng : 'np.random.RandomState ' ,
676
+ prng : 'np.random.Generator ' ,
677
677
) -> _SingleQubitLayerFactory :
678
678
"""Parse the `single_qubit_gates` argument for circuit generation functions.
679
679
@@ -690,10 +690,10 @@ def _single_qubit_gates_arg_to_factory(
690
690
def _two_qubit_layer (
691
691
coupled_qubit_pairs : List [GridQubitPairT ],
692
692
two_qubit_op_factory : Callable [
693
- ['cirq.GridQubit' , 'cirq.GridQubit' , 'np.random.RandomState ' ], 'cirq.OP_TREE'
693
+ ['cirq.GridQubit' , 'cirq.GridQubit' , 'np.random.Generator ' ], 'cirq.OP_TREE'
694
694
],
695
695
layer : GridInteractionLayer ,
696
- prng : 'np.random.RandomState ' ,
696
+ prng : 'np.random.Generator ' ,
697
697
) -> Iterator ['cirq.OP_TREE' ]:
698
698
for a , b in coupled_qubit_pairs :
699
699
if (a , b ) in layer or (b , a ) in layer :
0 commit comments