@@ -184,7 +184,7 @@ def random_rotations_between_two_qubit_circuit(
184184    q1 : 'cirq.Qid' ,
185185    depth : int ,
186186    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' 
188188    ] =  lambda  a , b , _ : ops .CZPowGate ()(a , b ),
189189    single_qubit_gates : Sequence ['cirq.Gate' ] =  (
190190        ops .X ** 0.5 ,
@@ -354,7 +354,7 @@ def _get_random_combinations(
354354
355355    combinations_by_layer  =  []
356356    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 )))
358358        combinations_by_layer .append (
359359            CircuitLibraryCombination (layer = layer , combinations = combinations , pairs = pairs )
360360        )
@@ -553,7 +553,7 @@ def random_rotations_between_grid_interaction_layers_circuit(
553553    depth : int ,
554554    * ,  # forces keyword arguments 
555555    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' 
557557    ] =  lambda  a , b , _ : ops .CZPowGate ()(a , b ),
558558    pattern : Sequence [GridInteractionLayer ] =  GRID_STAGGERED_PATTERN ,
559559    single_qubit_gates : Sequence ['cirq.Gate' ] =  (
@@ -641,7 +641,7 @@ def __init__(
641641        self ,
642642        qubits : Sequence ['cirq.Qid' ],
643643        single_qubit_gates : Sequence ['cirq.Gate' ],
644-         prng : 'np.random.RandomState ' ,
644+         prng : 'np.random.Generator ' ,
645645    ) ->  None :
646646        self .qubits  =  qubits 
647647        self .single_qubit_gates  =  single_qubit_gates 
@@ -651,9 +651,9 @@ def new_layer(self, previous_single_qubit_layer: 'cirq.Moment') -> 'cirq.Moment'
651651        def  random_gate (qubit : 'cirq.Qid' ) ->  'cirq.Gate' :
652652            excluded_op  =  previous_single_qubit_layer .operation_at (qubit )
653653            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 ))]
655655            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 ))]
657657            return  g 
658658
659659        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'
673673def  _single_qubit_gates_arg_to_factory (
674674    single_qubit_gates : Sequence ['cirq.Gate' ],
675675    qubits : Sequence ['cirq.Qid' ],
676-     prng : 'np.random.RandomState ' ,
676+     prng : 'np.random.Generator ' ,
677677) ->  _SingleQubitLayerFactory :
678678    """Parse the `single_qubit_gates` argument for circuit generation functions. 
679679
@@ -690,10 +690,10 @@ def _single_qubit_gates_arg_to_factory(
690690def  _two_qubit_layer (
691691    coupled_qubit_pairs : List [GridQubitPairT ],
692692    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' 
694694    ],
695695    layer : GridInteractionLayer ,
696-     prng : 'np.random.RandomState ' ,
696+     prng : 'np.random.Generator ' ,
697697) ->  Iterator ['cirq.OP_TREE' ]:
698698    for  a , b  in  coupled_qubit_pairs :
699699        if  (a , b ) in  layer  or  (b , a ) in  layer :
0 commit comments