Transformation Method: From Uniform Deviates to Linear Deviates

The Math.random() method of the java.lang.Math class generates random deviates with a uniform probability distribution, so that the probability of generating a number between x and x+dx, denoted by p(x)dx, is given by

Now suppose we generate a uniform deviate x and then take some prescribed function of it, y(x).  The probability distribution of y, denoted by p(y)dy, is determined by the funadamental transformation law of probabilities, which is simply


ref.) p.214, Numerical Recipes In C, W.H.Press, B.P.Flannery, S.A.Teukolsky, and W.T.Vetterling, Cambirdge Univ. Press, Cambridge (New York, 1988)

From uniform deviates to linear deviates




Therefore, a Java program which simply converts


will show the following result.  Here the y axis denotes the frequency of occurence for 0 < x < 0.1, 0.1 < x < 0.2, etc in the first plot, and similarly for the y-distribution in the second plot.