code: def _get_1samp_orders(n_samples, n_permutations, tail, rng):
      """Get the 1samp orders."""
      max_perms = 2 ** (n_samples - (tail == 0)) - 1
      extra = ""
      if isinstance(n_permutations, str):
          if n_permutations != "all":
              raise ValueError(
                  'n_permutations as a string must be "all"'
              )
          n_permutations = max_perms
      n_permutations = int(n_permutations)
      if max_perms < n_permutations:
          # omit first perm b/c accounted for in H0.append() later;
          # convert to binary array representation
          extra = " (exact test)"
          orders = bin_perm_rep(n_samples)[1 : max_perms + 1]
      elif (
          n_samples <= 20
      ):  # fast way to do it for small(ish) n_samples
          orders = rng.choice(
              max_perms, n_permutations - 1, replace=False
          )
          orders = [
              np.fromiter(np.binary_repr(s + 1, n_samples), dtype=int)
              for s in orders
          ]
      else:  # n_samples >= 64
          # Here we can just use the hash-table (w/collision detection)
          # functionality of a dict to ensure uniqueness
          orders = np.zeros((n_permutations - 1, n_samples), int)
          hashes = {}
          ii = 0
          # in the symmetric case, we should never flip one of the subjects
          # to prevent positive/negative equivalent collisions
          use_samples = n_samples - (tail == 0)
          while ii < n_permutations - 1:
              signs = tuple(
                  (rng.uniform(size=use_samples) < 0.5).astype(int)
              )
              if signs not in hashes:
                  orders[ii, :use_samples] = signs
                  if tail == 0 and rng.uniform() < 0.5:
                      # To undo the non-flipping of the last subject in the
                      # tail == 0 case, half the time we use the positive
                      # last subject, half the time negative last subject
                      orders[ii] = 1 - orders[ii]
                  hashes[signs] = None
                  ii += 1
      return orders, n_permutations, extra
  
imports: import numpy
  from scipy import ndimage, sparse
  from scipy.sparse.csgraph import connected_components
  from scipy.stats import f
  from scipy.stats import t
  from ..fixes import has_numba, jit
  from ..parallel import parallel_func
  from ..source_estimate import MixedSourceEstimate, SourceEstimate, VolSourceEstimate
  from ..source_space import SourceSpaces
  from ..utils import ProgressBar, _check_option, _pl, _validate_type, check_random_state, logger, split_list, verbose, warn
  from .parametric import f_oneway, ttest_1samp_no_p
label_desc: Use image node_id 23 for calling a global function with example usage: _get_1samp_orders(n_samples, n_permutations, tail, rng) and returns: orders,  n_permutations,  extra