|
|
|
|
|
by pash
457 days ago
|
|
The general version of this is called inverse transform sampling [0], which uses the fact that for the cdf F of any random variable X the random variable Y = F(X) has a standard uniform distribution [1]. Since every cdf increases monotonically on the unit interval, every cdf is invertible [2]. So apply the inverse cdf to both sides of the previous equation and you get F^-1(Y) = X is distributed like X. Sampling from a standard uniform distribution and then using the inverse transform is the commonest way of generating random numbers from an arbitrary distribution. 0. https://en.m.wikipedia.org/wiki/Inverse_transform_sampling 1. https://en.m.wikipedia.org/wiki/Probability_integral_transfo... 2. Not every cdf is one-to-one, however, so you may need a generalized inverse. |
|
If you're curious, I explore this algorithm and the theory behind it in https://blog.moertel.com/posts/2024-08-23-sampling-with-sql....