JAVA - exponential distribution

Ján Яabčan picture Ján Яabčan · Mar 12, 2015 · Viewed 13.8k times · Source

I need to find formula for exponential distribution of probability, but i don´t know how to find it :( This formula have to have a powerful statistical properties(it can´t throw away any result from random to keep indistructed seek of random instance)

i am trying to find formula, which will work in method like this:

rand.getNextDuobleExpDistrib();

I have this code for now, but according to "input analyser" it doesn´t work correctly

public double getNext() {
        return -lampda * Math.log(rand.nextDouble());
 }

Answer

Florian Prud'homme picture Florian Prud'homme · Mar 12, 2015

You can see this answer : Pseudorandom Number Generator - Exponential Distribution

Here the java code

public double getNext() {
    return  Math.log(1-rand.nextDouble())/(-lambda);
}

Have a nice day