Draw a random sample from a probability distribution

random(d, n = 1L, ...)

Arguments

d

A probability distribution object such as those created by a call to Bernoulli(), Beta(), or Binomial().

n

The number of samples to draw. Should be a positive integer. Defaults to 1L.

...

Unused. Unevaluated arguments will generate a warning to catch mispellings or other possible errors.

Examples

X <- Normal() random(X, 10)
#> [1] 1.0257815 0.1983745 1.1180052 -0.5388263 -1.1279531 -0.1215207 #> [7] 0.2383239 0.8897457 0.1333649 0.2940266