Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JAVA - exponential distribution

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());
}
like image 782
Ján Яabčan Avatar asked Mar 12 '15 21:03

Ján Яabčan


People also ask

How do you define exponential distribution?

What is Exponential Distribution? In Probability theory and statistics, the exponential distribution is a continuous probability distribution that often concerns the amount of time until some specific event happens. It is a process in which events happen continuously and independently at a constant average rate.

What is the CDF of exponential distribution?

Details. The CDF function for the exponential distribution returns the probability that an observation from an exponential distribution, with the scale parameter λ, is less than or equal to x.

How do you know if a distribution is exponential?

An exponential distribution will plot as a straight line against −ln(1−plotting position) where plotting position is (rank −a)/(n−2a+1), rank is 1 for lowest value, n is sample size, and popular choices for a include 1/2.


1 Answers

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

like image 91
Florian Prud'homme Avatar answered Sep 22 '22 13:09

Florian Prud'homme