Section: Random Number Generation
y = randmulti(N,pvec)
where N is the number of experiments to perform, and pvec
is the vector of probabilities describing the distribution of
outcomes.
m possible outcomes occurs out of N trials, where each
outcome has a probability p_i. More generally, suppose that
the probability of a Bernoulli random variable X_i is p_i,
and that
Then the probability that X_i occurs x_i times is
0.4999, 0.4999 and
0.0002, respectively. Then if we perform ten thousand coin
flips we get
--> randmulti(10000,[0.4999,0.4999,0.0002]) ans = 5026 4973 1