def _set_random_states(estimator, random_state=None):
 random_state = check_random_state(random_state)
 to_set = {}
 for key in sorted(estimator.get_params(deep=True)):
  if ((key == 'random_state') or key.endswith('__random_state')):
   to_set[key] = random_state.randint(MAX_RAND_SEED)
 if to_set:
  estimator.set_params(**to_set)

def _set_random_states ( estimator , random_state = None ) : random_state = check_random_state ( random_state ) to_set = { } for key in sorted ( estimator . get_params ( deep = True ) ) : if ( ( key == 'random_state' ) or key . endswith ( '__random_state' ) ) : to_set [ key ] = random_state . randint ( MAX_RAND_SEED ) if to_set : estimator . set_params ( ** to_set )
sets fixed random_state parameters for an estimator finds all parameters ending random_state and sets them to integers derived from random_state .