code: def _generate_idx(n, seed, n_train, n_test):
      
      idx = check_random_state(seed).permutation(n)
  
      ind_test = idx[:n_test]
      ind_train = idx[n_test : n_train + n_test]
      return ind_train, ind_test
docs: Generate train, test indices for a length-n array.
  
      Parameters
      ----------
      n : int
          The length of the array
      seed : int
          Seed for a RandomState
      n_train, n_test : int, 0 < n_train, n_test < n
          Number of samples to use for the train or
          test index.
  
      Notes
      -----