| random.distribution | R Documentation |
Generates random numbers from a distribution object by mapping uniform random variates through the target quantile function.
## S3 method for class 'distribution'
random(x, n = 1L, drop = TRUE, ...)
x |
An object of class |
n |
Number of observations. If |
drop |
logical. Should the result be simplified to a vector if possible? |
... |
currently unused. |
A numeric vector of random values if length(d) equals one
or n = 1L and drop = TRUE (default), or a matrix where rows correspond
to the distribution(s) d whilst the columns contain the random values.
## Drawing random numbers from a Poisson distribution
## using the inverse transform sampling method
random.distribution(Poisson(3), n = 6)
## Drawing random numbers from a series of Normal distributions
## using the inverse transform sampling method
random.distribution(Normal(1:3, 1:3 / 2), n = 6)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.