rlaplace_truncated_centered: Generates centered laplace variables with scale 1.

View source: R/rand_gen.R

rlaplace_truncated_centeredR Documentation

Generates centered laplace variables with scale 1.

Description

Generates centered laplace variables with scale 1.

Usage

rlaplace_truncated_centered(n, lo, hi)

Arguments

n

An integer, the number of samples to return.

lo

A double, the lower limit of the distribution.

hi

A double, the upper limit of the distribution.

Details

Returns n random variables from the truncated laplace distribution with density proportional to \exp(-|x|) on [lo,hi].

Value

n random variables from the truncated laplace distribution.

Examples

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

genscore documentation built on May 29, 2024, 9 a.m.