# SuanShu, a Java numerical and statistical library

com.numericalmethod.suanshu.stats.random.rng.multivariate

## Class MultinomialRVG

• java.lang.Object
• com.numericalmethod.suanshu.stats.random.rng.multivariate.MultinomialRVG
• All Implemented Interfaces:
RandomVectorGenerator, Seedable

public class MultinomialRVG
extends Object
implements RandomVectorGenerator
A multinomial distribution puts N objects into K bins according to the bins' probabilities. An output random vector counts the number of objects in each bin, making a total of N.

The R equivalent function is rmultinom in package normix.

• ### Constructor Summary

Constructors
Constructor and Description
MultinomialRVG(int N, double[] prob)
Constructs a multinomial random vector generator.
MultinomialRVG(int N, double[] prob, RandomLongGenerator uniform)
Constructs a multinomial random vector generator.
• ### Method Summary

All Methods
Modifier and Type Method and Description
double[] nextVector()
Get the next random vector.
void seed(long... seeds)
Seed the random number/vector/scenario generator to produce repeatable experiments.
• ### Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
• ### Constructor Detail

• #### MultinomialRVG

public MultinomialRVG(int N,
double[] prob,
RandomLongGenerator uniform)
Constructs a multinomial random vector generator.
Parameters:
N - an integer, say N, specifying the total number of objects that are put into K boxes in a typical multinomial experiment
prob - a numeric non-negative vector of length K, specifying the probability for the K boxes
uniform - a uniform random number generator
• #### MultinomialRVG

public MultinomialRVG(int N,
double[] prob)
Constructs a multinomial random vector generator.
Parameters:
N - an integer, say N, specifying the total number of objects that are put into K boxes in a typical multinomial experiment
prob - a numeric non-negative vector of length K, specifying the probability for the K boxes
• ### Method Detail

• #### seed

public void seed(long... seeds)
Description copied from interface: Seedable
Seed the random number/vector/scenario generator to produce repeatable experiments.
Specified by:
seed in interface Seedable
Parameters:
seeds - the seeds
• #### nextVector

public double[] nextVector()
Description copied from interface: RandomVectorGenerator
Get the next random vector.
Specified by:
nextVector in interface RandomVectorGenerator
Returns:
the next random vector