The Random Class
Expression
Math.abs (rand.newInt()) % 6 + 1
Math.abs (rand.newInt()) % 10 + 1
Math.abs (rand.newInt()) % 101
Math.abs (rand.newInt()) % 11 + 20
Math.abs (rand.newInt()) % 11 - 5
Range
1 to 6
1 to 10
0 to 100
20 to 30
-5 to 5
Previous slide
Next slide
Back to first slide
View graphic version