Skip to contents

This function generates random samples of a given size based on a ddf distribution.

Usage

samples(dist, n)

Source

To generate the samples, base::sample() is used.

Arguments

dist

A ddf object, the distribution.

n

A non-negative integer giving the number of items to choose.

Value

A vector of length n with elements drawn from the distributions support.

Examples

# Simulate throwing a dice 5 times
samples(unif(6), 5)
#> [1] 2 1 5 2 2