Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Random Number Generation within range with different distribution in Java

I want to generate Random number in different range. For example range 10^14 in Java with different distribution like log, normal, binomial etc. Is there any particular library for the same. I found discussion on colt and math uncommon library. But is it safe enough to generate values as int and then multiply by the corresponding range suffix. What is best practice for the same.

like image 470
Allahbaksh Asadullah Avatar asked Dec 22 '25 14:12

Allahbaksh Asadullah


1 Answers

Apache Commons Math has a RandomDataImpl class that does nextBinomial, nextExponential and some other types (above my head unfortunately).

Hopefully that gets you everything you need. You might need to check some of the other classes in the library.

like image 199
pimaster Avatar answered Dec 24 '25 04:12

pimaster



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!