Binomial random numbers
R = binornd(N,P)
R = binornd(N,P,m,n,...)
R = binornd(N,P,[m,n,...])
R = binornd(N,P) generates
random numbers from the binomial distribution with parameters specified
by the number of trials,
N, and probability of
success for each trial,
be vectors, matrices, or multidimensional arrays that have the same
size, which is also the size of
R. A scalar input
P is expanded to a
constant array with the same dimensions as the other input.
R = binornd(N,P,m,n,...) or
R = binornd(N,P,[m,n,...]) generates an
array containing random numbers from the binomial distribution with
each be scalars or arrays of the same size as
n = 10:10:60; r1 = binornd(n,1./n) r1 = 2 1 0 1 1 2 r2 = binornd(n,1./n,[1 6]) r2 = 0 1 2 1 3 1 r3 = binornd(n,1./n,1,6) r3 = 0 1 1 1 0 3
Usage notes and limitations:
The generated code can return a different sequence of numbers than MATLAB® if either of the following is true:
The output is nonscalar.
An input parameter is invalid for the distribution.