Можно ли указать верхнюю и нижнюю границы nextInt в Mersenne Twister RNG (Java)JAVA

Программисты JAVA общаются здесь
Anonymous
Можно ли указать верхнюю и нижнюю границы nextInt в Mersenne Twister RNG (Java)

Сообщение Anonymous »


I have a requirement to generate random numbers, specifically using the Mersenne Twister algorithm, in either Java/Kotlin (for Android). I've tried using the Apache commons-math Mersenne Twister implementation which works great to generate random integers. However I need to specify a fairly small range for these, the ints must be between 1 and 100.

It doesn't seem to be possible to specify upper and lower bounds with the Apache implementation. Does anyone know of any alternative Mersenne Twister options for Java/Kotlin that accept bounds for the nextInt generated?


Источник: https://stackoverflow.com/questions/569 ... rsenne-twi

Вернуться в «JAVA»