rlaplace: Generates a Laplace-distributed sample

View source: R/RcppExports.R

rlaplaceR Documentation

Generates a Laplace-distributed sample

Description

Returns a sample from a Laplace-distributed random variable.

Usage

rlaplace(n, m = 0, a = 1)

Arguments

n

(int) - the size of the sample.

m

(numeric) - the location parameter.

a

(numeric) - the scale parameter.

Details

The Laplace distribution is given by the two-sided exponential distribution given by the function:

f(x;a,m) = \frac{1}{2a} e^{- \left| \frac{x-m}{a} \right|}

The random sampling is done by inverse transform sampling.

Value

a numeric vector containing a random sample with above parameters.

Examples

sample_gamma <- rlaplace(1000, 0, 1)

Rsubbotools documentation built on April 16, 2025, 5:10 p.m.