def _shuffle(y, groups, random_state):
 if (groups is None):
  indices = random_state.permutation(len(y))
 else:
  indices = np.arange(len(groups))
  for group in np.unique(groups):
   this_mask = (groups == group)
   indices[this_mask] = random_state.permutation(indices[this_mask])
 return safe_indexing(y, indices)

def _shuffle ( y , groups , random_state ) : if ( groups is None ) : indices = random_state . permutation ( len ( y ) ) else : indices = np . arange ( len ( groups ) ) for group in np . unique ( groups ) : this_mask = ( groups == group ) indices [ this_mask ] = random_state . permutation ( indices [ this_mask ] ) return safe_indexing ( y , indices )
return a shuffled copy of y eventually shuffle among same labels .