def _get_permutations(num_results, dims, seed=None):
  """
  """
  sample_range = tf.range(num_results)
  stream = distributions.SeedStream(seed, salt='MCMCSampleHaltonSequence3')
  def generate_one(d):
    seed = stream()
    fn = lambda _: tf.random.shuffle(tf.range(d), seed=seed)
    return tf.map_fn(
        fn,
        sample_range,
        parallel_iterations=1 if seed is not None else 10)
  return tf.concat([generate_one(d) for d in tf.unstack(dims)],
                   axis=-1)