Library: | distribs |
See also: | pdfbin cdfbin qfbin |
Quantlet: | randbin | |
Description: | computes random numbers based on the binomial distribution |
Usage: | z = randbin (n, p, len) | |
Input: | ||
n | scalar parameter of the binomial distribution | |
p | scalar parameter of the binomial distribution | |
len | scalar number of random numbers | |
Output: | ||
z | len x 1 vector of random numbers |
; loads the library "stats" library("distribs") ; reset random generator randomize(0) randbin(1, 0.5, 10)
Contents of z [ 1,] 0 [ 2,] 0 [ 3,] 0 [ 4,] 0 [ 5,] 0 [ 6,] 0 [ 7,] 0 [ 8,] 1 [ 9,] 1 [10,] 0