Statistics Toolbox    
binornd

Random numbers from the binomial distribution

Syntax

Description

R = binornd(N,P) generates random numbers from the binomial distribution with parameters specified by N and P. Vector or matrix inputs for N and P must have the same size, which is also the size of R. A scalar input for N or P is expanded to a constant matrix with the same dimensions as the other input.

R = binornd(N,P,mm) generates a matrix of size mm containing random numbers from the binomial distribution with parameters N and P, where mm is a 1-by-2 vector containing the row and column dimensions of R.

R = binornd(N,p,mm,nn) generates an mm-by-nn matrix containing random numbers from the binomial distribution with parameters N and P.

Algorithm

The binornd function uses the direct method using the definition of the binomial distribution as a sum of Bernoulli random variables.

Examples

See Also

binocdf, binofit, binoinv, binopdf, binostat, rand, randtool


  binopdf binostat