JAVA - 指数分布
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/29020652/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
JAVA - exponential distribution
提问by Ján Яab?an
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());
}
回答by Florian Prud'homme
You can see this answer : Pseudorandom Number Generator - Exponential Distribution
你可以看到这个答案:伪随机数生成器 - 指数分布
Here the java code
这里是java代码
public double getNext() {
return Math.log(1-rand.nextDouble())/(-lambda);
}
Have a nice day
祝你今天过得愉快