Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.3k views
in Technique[技术] by (71.8m points)

math - JAVA - exponential distribution

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());
 }
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...