rdens: Random density deviates

Description Usage Arguments Value Examples

View source: R/rdens.R

Description

This function generates random deviates of a given probability density analogously to runif and rnorm in case of the uniform and normal distribution respectively.

Usage

1
rdens(dens, n)

Arguments

dens

a probability density on the intervall [0,1]

n

a natural number, which specifies the number of deviates to be generated

Value

a numeric vector of length n containing random deviates of dens

Examples

1
2
3
4
#defining a density on [0,1]
dens1 <- function(x) 1 + 0.5 * sin(2 * pi * x)
#generated 50 deviates
rdens(dens1, 50)

nschaefer1211/OSE documentation built on Dec. 31, 2020, 12:59 a.m.