Learn R Programming

distributions3 (version 0.2.0)

random: Draw a random sample from a probability distribution

Description

Draw a random sample from a probability distribution

Usage

random(x, n = 1L, drop = TRUE, ...)

Value

Random samples drawn from the distriubtion x.

Arguments

x

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.

drop

logical. Should the result be simplified to a vector if possible?

...

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

Examples

Run this code

X <- Normal()

random(X, 10)

Run the code above in your browser using DataLab