def multinomial(random_state, size=None, n=1, pvals=[0.5, 0.5], ndim=None, dtype='int64'):
 n = tensor.as_tensor_variable(n)
 pvals = tensor.as_tensor_variable(pvals)
 tmp = pvals.T[0].T
 (ndim, size, bcast) = _infer_ndim_bcast(ndim, size, n, tmp)
 bcast = (bcast + (pvals.type.broadcastable[(-1)],))
 op = RandomFunction(multinomial_helper, tensor.TensorType(dtype=dtype, broadcastable=bcast), ndim_added=1)
 return op(random_state, size, n, pvals)

def multinomial ( random_state , size = None , n = 1 , pvals = [ 0.5 , 0.5 ] , ndim = None , dtype = 'int64' ) : n = tensor . as_tensor_variable ( n ) pvals = tensor . as_tensor_variable ( pvals ) tmp = pvals . T [ 0 ] . T ( ndim , size , bcast ) = _infer_ndim_bcast ( ndim , size , n , tmp ) bcast = ( bcast + ( pvals . type . broadcastable [ ( - 1 ) ] , ) ) op = RandomFunction ( multinomial_helper , tensor . TensorType ( dtype = dtype , broadcastable = bcast ) , ndim_added = 1 ) return op ( random_state , size , n , pvals )
sample from one or more multinomial distributions defined by one-dimensional slices in pvals .