I have a known parameters mu and sigma for lognormal distribution, and I don not know the lower and upper bound or interval for the random variable. I know (Random.nextGaussian() * sigma ) + mu used to generat random variat for normal distribution with mu and sigma parameters. However, how can I generate a random number from the lognormal distribution with known mu and sigma using Java? Thank you.
Use apache commons math to create a LogNormalDistribution.
Double mu = 0.0;
Double sigma = 0.0;
LogNormalDistribution logNormal = new LogNormalDistribution(sigma, mu);
System.out.println("Random Value : " + logNormal.sample());