{ } Raw JSON

bundles / scipy 1.17.1 / scipy / stats / _multivariate / multinomial_gen / rvs

function

scipy.stats._multivariate:multinomial_gen.rvs

source: /scipy/stats/_multivariate.py :4198

Signature

def   rvs ( self n p size = None random_state = None )

Summary

Draw random samples from a Multinomial distribution.

Parameters

n : int

Number of trials

p : array_like

Probability of a trial falling into each category; should sum to 1

size : integer or iterable of integers, optional

Number of samples to draw (default 1).

seed : {None, int, np.random.RandomState, np.random.Generator}, optional

Used for drawing random variates. If seed is None, the ~np.random.RandomState singleton is used. If seed is an int, a new RandomState instance is used, seeded with seed. If seed is already a RandomState or Generator instance, then that object is used. Default is None.

Returns

rvs : ndarray or scalar

Random variates of shape (size, len(p))

Notes

n should be a nonnegative integer. Each element of p should be in the interval and the elements should sum to 1. If they do not sum to 1, the last element of the p array is not used and is replaced with the remaining probability left over from the earlier elements.

Aliases

  • scipy.stats._multivariate.multinomial_gen.rvs