rexp_truncated: Generates translated and truncated exponential variables.

View source: R/rand_gen.R

rexp_truncatedR Documentation

Generates translated and truncated exponential variables.

Description

Generates translated and truncated exponential variables.

Usage

rexp_truncated(n, lo, hi)

Arguments

n

An integer, the number of samples to return.

lo

A double, the lower limit of the distribution, cannot be -Inf.

hi

A double, the upper limit of the distribution.

Details

Returns n random variables from the translated truncated exponential distribution with density \exp(-(x-lo))/(1-\exp(lo-hi)) on [lo,hi].

Value

n random variables from the translated truncated exponential distribution.

Examples

hist(rexp_truncated(1e4, 0, Inf), breaks=200)
hist(rexp_truncated(1e4, 10, 12), breaks=200)
hist(rexp_truncated(1e4, -2, 2), breaks=200)
hist(rexp_truncated(1e4, -10, 0), breaks=200)
hist(rexp_truncated(1e4, -100, Inf), breaks=200)
hist(rexp_truncated(1e4, -100, -95), breaks=200)

genscore documentation built on May 31, 2023, 6:28 p.m.