in reply to Skew normally distributed random numbers
In less mathematical terms (but only slightly): Assume the chance of x falling between xi and xi+dx is as close to P(xi)*dx as you can get, with dx very small. Then yi = D(xi), with formula 10 connection the two functions — meaning P(x)*dx ≈ D(x+dx)-D(x) for all x, is the chance that x < xi. This chance is between 0 (for xi = -inf) to 1 (for xi = +inf).
Note that Perl's rand function returns an approximately uniform distribution between 0 and 1. Let's say you pick one of these random numbers, use them as the current value for yi, and via the inverse function of D(x) get back a value for xi. Well: those values for x that you get back this way, are distributed with probability function P(x). Et voilą.
So all you need is sub implementing approximately the inverse function for D(x).
|
|---|