code: def permutation(args):
      """Fork safe permutation function.
  
      This function can be called within a multiprocessing worker and give
      appropriately random results.
  
      Args:
        args: A size two tuple that will unpacked into the size of the permutation
          and the random seed. This form is used because starmap is not universally
          available.
  
      returns:
        A NumPy array containing a random permutation.
      """
      x, seed = args
  
      # If seed is None NumPy will seed randomly.
      state = np.random.RandomState(
          seed=seed
      )  # pylint: disable=no-member
      output = np.arange(x, dtype=np.int32)
      state.shuffle(output)
      return output
  
file_path: autodist/examples/benchmark/utils/recommendation/stat_utils.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import os
  import numpy
label_desc: Use image node_id 2 for calling a global function with example usage: permutation(args) and returns: output