code: def multinomial(
      n=[1],
      p=[[1.0]],
      shape=_Null,
      dtype="float32",
      ctx=None,
      out=None,
      **kwargs,
  ):
      """Concurrent sampling from multiple multinomial distributions.
  
      .. note:: The input distribution must be normalized, i.e. `p` must sum to
                1 along its last dimension.
  
      Parameters
      ----------
      n : NDArray
          An *n* dimensional array containing the number of trials of each
          multinomial distribution.
      p : NDArray
          An *n+1* dimensional array containing the probabilities of each multinomial
          distribution. Its last dimension has length `k`, where `k` is the number
          of possible outcomes of each multinomial distribution.
          For example, p with shape `(m, n, k)` specifies `m*n` multinomial
          distributions each with `k` possible outcomes.
      shape : int or tuple of ints, optional
          The number of samples to draw from each distribution. If shape is empty
          one sample will be drawn from each distribution.
      out : NDArray, optional
          Store output to an existing NDArray.
      ctx : Context, optional
          Device context of output. Default is current context. Overridden by
          `n.context` when `n` is an NDArray.
      dtype : {'float16', 'float32', 'float64'}, optional
          Data type of output samples. Default is 'float32'
  
      Returns
      -------
      NDArray
          If input `shape` has shape, e.g., `(m, n)` and `n` and `p` are a scalar and an array of length k
          respectively, output shape will be `(m, n, k)`. If `n` and `p` are NDArrays with shape, e.g.,
          `(x, y)` and `(x, y, k)`, then output will have shape `(x, y, m, n, k)`, where `m*n`
          samples are drawn for each `[n, p)` pair.
  
      Examples
      --------
      >>> mx.nd.random.multinomial(mx.nd.array([10]), mx.nd.array([[0.1, 0.9]]))
      [[ 1. 9.]]
      <NDArray 1x2 @cpu(0)>
      >>> mx.nd.random.multinomial(mx.nd.array([10]), mx.nd.array([[0.6, 0.4]]), shape=(2,))
      [[[ 5. 5.]
        [ 6. 4.]]]
      <NDArray 1x2x2 @cpu(0)>
      >>> n = mx.nd.array([10, 2, 3])
      >>> p = mx.nd.array([[0.2, 0.8], [0.3, 0.7], [0.4, 0.6]])
      >>> mx.nd.random.binomial(n, p)
      [[  2. 8.]
       [  1. 1.]
       [  1. 2.]]
      <NDArray 3x2 @cpu(0)>
      """
      return _internal._sample_multinomial(
          n, p, shape=shape, out=out, ctx=ctx, dtype=dtype, **kwargs
      )
  
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 12 for calling a global function with example usage: multinomial(n, p, shape, dtype, ctx, out) and returns: _internal