BYNotes

Home

❯

Computational Statistics

❯

Generating Exponential Random Variables from Uniforms

Generating Exponential Random Variables from Uniforms

May 25, 20261 min read

  • course/computational-statistics
  • topic/random-variable-generation
  • topic/inverse-transform

1. Goal

Generate a random variable X∼exp(λ) with CDF:

F(x)=1−e−λx.

2. Inverse Transform

Let

u=F(x)=1−e−λx.

Solving for x gives:

x=−λ1​log(1−u).

Equivalently:

X=−λ1​log(u)​.

3. Code

% set up the parameters.
lam = 2;
 
% generate the rv's
uni = rand(1, n);
X = -log(uni) / lam;

Related Notes

  • Generating Continuous Random Variables
  • Change of Variables for Probability Distributions

Graph View

  • 1. Goal
  • 2. Inverse Transform
  • 3. Code
  • Related Notes

Backlinks

  • Box-Muller Transformation
  • Generating Geometric Random Variables from Uniforms
  • Generating Continuous Random Variables
  • Computational Statistics

Created with Quartz v4.5.2 © 2026

  • Homepage
  • GitHub
  • RSS