8

I need to find a formula for exponential distribution of probability, but I don´t know how to find it. This formula has to have 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 a method like this:

rand.getNextDoubleExpDistrib();

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());
}
Michael Mior
  • 28,107
  • 9
  • 89
  • 113
Ján Яabčan
  • 743
  • 2
  • 10
  • 20
  • 1
    Does this answer your question? [Pseudorandom Number Generator - Exponential Distribution](https://stackoverflow.com/questions/2106503/pseudorandom-number-generator-exponential-distribution) – Welbog Jul 13 '20 at 17:49

1 Answers1

21

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

Community
  • 1
  • 1