error code
private static Random RANDOM = new Random();
private static Integer randomOnce(Integer max, Integer min) {
return RANDOM.nextInt(max) % (max - min + 1) + min;
}
Error message
java.lang.IllegalArgumentException: bound must be positive
at java.util.Random.nextInt(Random.java:388)
Solution
private static Random RANDOM = new Random();
private static Integer randomOnce(Integer max, Integer min) {
if (max<=0)
throw new IllegalArgumentException("Random positive must be greater than 0");
return RANDOM.nextInt(max) % (max - min + 1) + min;
}
Read More:
- Matlab: Three forms of random number generated (Rand, Randi and Randn)
- Tensorflow image random_ There seems to be something wrong with the shift function
- numpy.random.rand()
- Random forest algorithm learning
- Python random selects elements randomly from a collection
- 26 English letters in upper and lower case and 0-9 to generate 8-bit random password
- P – Random Teams
- Out of bag error in Random Forest
- matlab Error Subscript indices must either be real positive integers or logicals.
- The echots in Vue reports an error. After obtaining the DOM element, the chart can be displayed. The console still reports an error
- ValueError: num_samples should be a positive integer value, but got num_samp=0
- Solve the problem of illegalargumentexception: at least one JPA metadata must be present
- Dca1000 reports an error and the SPI port cannot be connected
- Oracle reports an error and lsnrctl listening cannot be started
- HTML method IE8 reports an error, IE8 jQuery Ajax obtains static resources reports an error, typeerror denies access
- java.lang.IllegalArgumentException: Address 127.0.0.1:5672:5672 seems to contain an unquoted IPv6
- [OpenGL · error] visual studio 2019 reports an error. It is an external symbol gladloadglloader that cannot be parsed. This symbol is referenced in the function main
- Android network request framework okhttputils reports an error (okhttp3 cannot be found)
- Lamdba in the studio part reports an error. Observe lamdba reports an error but can run
- Hadoop reports an error. Cannot access scala.serializable and python MapReduce reports an error