-2
A
回答
0
您需要使用例如實現算法:
- JSR223Timer
- 的Groovy作爲定時器
- 而這些算法實現的一個語言: How to generate a random number with a specific probability density function?
編輯2/08/2016:
您使用BeanShell(JSR223 + Groovy會執行得更好)選項來利用Apache commons.math3庫。
示例代碼:
import org.apache.commons.math3.distribution.WeibullDistribution;
alpha = Integer.parseInt(vars.get("alpha"));
beta = Integer.parseInt(vars.get("beta"));
rng= Integer.parseInt(bsh.args[0]);
try {
WeibullDistribution g= new WeibullDistribution(rng, alpha,beta);
return g.sample();
} catch (Throwable ex) {
log.error("Something wrong", ex);
throw ex;
}
那是有幫助的!我使用BeanShell選項來利用commons.math3庫。 import org.apache.commons.math3.distribution.WeibullDistribution; alpha = Integer.parseInt(vars.get(「alpha」)); beta = Integer.parseInt(vars.get(「beta」)); rng = Integer.parseInt(bsh.args [0]); try { WeibullDistribution g = new WeibullDistribution(rng,alpha,beta); return g.sample(); } catch(Throwable ex){ log.error(「Something wrong」,ex);投擲前; } –
如果是這樣,你應該接受我的答案,並upvote它,以便其他用戶可以使用它。隨意修改您的評論。謝謝 –