General principle

  • We can generate random numbers via an inverse problem.

  • First, it turns out that is not difficult for a modern computers to generate random numbers uniformly, and, between 0 and 1 .

  • Now, suppose we want to generate random numbers from another random variable X, with cummulative distribution function FX.

  • Recall that the values of FX lie between 0 and 1.

  • Also, not only is FX a non-decreasing function, for most common cases it’s actually strictly increasing, which allows us to correctly define its inverse fuction F1X.

  • Then, we can generate random numbers whose distribution is fX, as follows:

    • Generate a random number u between 0 and 1 .
    • Calculate the unique value F1X(u).
    • Theorem: Let X,Y,U be random variables such that UUniform(0,1) and Y=F1X(U). Then, the CDF of Y is FX.
  • Examples:

    • Generate Gaussian random numbers with mean μ and variance σ2.
      • The CDF of the ideal distribution is FX(x)=Φ(xμσ).
      • The transformation becomes F1X(U)=σΦ1(U)+μ.
    • Generate exponential random numbers with parameter λ.
      • The CDF of the ideal distribution is FX(x)=1eλx.
      • The transformation becomes F1(U)=1λlog(1U)