Generating Random Variates From An Inverse-Gaussian Distribution
The following algorithm may be used.
Generate a random variate from a normal distribution with a mean of 0 and 1 standard deviation
Square the value
and use this relation
Generate another random variate, this time sampled from a uniformed distribution between 0 and 1
If
then return
else return
Sample code in Java:
public double inverseGaussian(double mu, double lambda) { Random rand = new Random; double v = rand.nextGaussian; // sample from a normal distribution with a mean of 0 and 1 standard deviation double y = v*v; double x = mu + (mu*mu*y)/(2*lambda) - (mu/(2*lambda)) * Math.sqrt(4*mu*lambda*y + mu*mu*y*y); double test = rand.nextDouble; // sample from a uniform distribution between 0 and 1 if (test <= (mu)/(mu + x)) return x; else return (mu*mu)/x; }Read more about this topic: Inverse Gaussian Distribution
Famous quotes containing the words random and/or distribution:
“... the random talk of people who have no chance of immortality and thus can speak their minds out has a setting, often, of lights, streets, houses, human beings, beautiful or grotesque, which will weave itself into the moment for ever.”
—Virginia Woolf (18821941)
“There is the illusion of time, which is very deep; who has disposed of it? Mor come to the conviction that what seems the succession of thought is only the distribution of wholes into causal series.”
—Ralph Waldo Emerson (18031882)






