code: def shuffle_data(X, y=None, sample_weight=None):
      ''' Shuffles indices X, y, and sample_weight together'''
      if len(X) > 1:
          ind = np.arange(len(X), dtype=np.int)
          np.random.shuffle(ind)
          Xt = X[ind]
          yt = y
          swt = sample_weight
  
          if yt is not None:
              yt = yt[ind]
          if swt is not None:
              swt = swt[ind]
  
          return Xt, yt, swt
      else:
          return X, y, sample_weighf shuffle_data(X, y=None, sample_weight=None):
      ''' Shuffles indices X, y, and sample_weight together'''
      if len(X) > 1:
          ind = np.arange(len(X), dtype=np.int)
          np.random.shuffle(ind)
          Xt = X[ind]
          yt = y
          swt = sample_weight
  
          if yt is not None:
              yt = yt[ind]
          if swt is not None:
              swt = swt[ind]
  
          return Xt, yt, swt
      else:
          return X, y, sample_weight
docs: Shuffles indices X, y, and sample_weight together