bundles / scipy 1.18.0 / scipy / stats / _multivariate / multinomial_gen / rvs
function
scipy.stats._multivariate:multinomial_gen.rvs
Signature
def rvs(self, n, p, size = None, random_state = None)Summary
Draw random samples from a Multinomial distribution.
Parameters
n: intNumber of trials
p: array_likeProbability of a trial falling into each category; should sum to 1
size: int or iterable of integers, optionalNumber of samples to draw (default 1).
seed: {None, int, np.random.RandomState, np.random.Generator}, optionalUsed for drawing random variates. If seed is None, the
~np.random.RandomStatesingleton is used. If seed is an int, a newRandomStateinstance is used, seeded with seed. If seed is already aRandomStateorGeneratorinstance, then that object is used. Default is None.
Returns
rvs: ndarray or scalarRandom 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