Random Integer in a Range
Which of the following statements correctly assigns a random integer between 25 and 60, inclusive, to the int variable rn?
A
int rn = (int) (Math.random() * 26) + 60;
B
int rn = (int) (Math.random() * 25) + 60;
C
int rn = (int) (Math.random() * 25) + 36;
D
int rn = (int) (Math.random() * 36) + 25;
Question Leaderboard
| Rank | |||||
|---|---|---|---|---|---|
| #1 | ngvandangthanh | 1 | 1 | 0m 00s | 100 |
| #2 | patrickmeijer009 | 1 | 2 | 0m 28s | 62 |
| #3 | bommasam000 | 1 | 3 | 0m 46s | 34 |
| #4 | thewrizzler6 | 0 | 2 | 0m 02s | -22 |
| #5 | shelter2002004 | 0 | 1 | 0m 19s | -29 |
| #6 | 108185265 | 1 | 4 | 2m 07s | -57 |
| #7 | zgj07310417 | 0 | 1 | 1m 03s | -73 |
| #8 | y.seong2027 | 1 | 3 | 3m 22s | -122 |
| #9 | parth.taur227 | 0 | 1 | 3m 02s | -192 |
| #10 | lsj08030922 | 1 | 2 | 42m 38s | -2,468 |
Items per page:
10
1 – 10 of 11
APFIVE