code: def _random_helper(
      random, sampler, params, shape, dtype, ctx, out, kwargs
  ):
      """Helper function for random generators."""
      if isinstance(params[0], NDArray):
          for i in params[1:]:
              assert isinstance(i, NDArray), (
                  "Distribution parameters must all have the same type, but got "
                  f"both {type(params[0])} and {type(i)}."
              )
          return sampler(
              *params, shape=shape, dtype=dtype, out=out, **kwargs
          )
      elif isinstance(params[0], numeric_types):
          if ctx is None:
              ctx = current_context()
          if shape is _Null and out is None:
              shape = 1
          for i in params[1:]:
              assert isinstance(i, numeric_types), (
                  "Distribution parameters must all have the same type, but got "
                  f"both {type(params[0])} and {type(i)}."
              )
          return random(
              *params,
              shape=shape,
              dtype=dtype,
              ctx=ctx,
              out=out,
              **kwargs,
          )
  
      raise ValueError(
          "Distribution parameters must be either NDArray or numbers, "
          f"but got {type(params[0])}."
      )
  
file_path: mxnet/python/mxnet/ndarray/random.py
imports: from ..base import numeric_types, _Null
  from ..context import current_context
  from .None import _internal
  from .ndarray import NDArray
label_desc: Use image node_id 1 for calling a global function with example usage: _random_helper(random, sampler, params, shape, dtype, ctx, out, kwargs) and returns: sampler, random