+ 3
Random integers in Java
How to generate random integers between a interval
3 Antworten
+ 6
Another way from 0 to some number:
Math.random() * max;
No imports required.
+ 5
Random r = new Random();
int hi = 10;
int lo = 1;
int number = r.nextInt(hi-lo) + lo;
+ 4
random.nextInt( max - min + 1 ) + min