Reputation: 3
just a quick question. I'm pretty new to programming and I'm having trouble figuring out what the range of e = rand.nextInt(10) * 4
would be. Can someone please help me out? I've already tried all the obvious answers and they weren't right.
Upvotes: 0
Views: 58
Reputation: 5239
From nextInt
Returns a pseudorandom, uniformly distributed int value between 0 (inclusive) and the specified value (exclusive).
nextInt(10)
will return a random number within the range of 0-9
because the number 10
is exclusive, therefore that times 4
will return a range of 0-36
.
Like @Jesper mentioned it will be multiples of 4
, so 0, 4, 8, 12, 16, 20, 24, 28, 32, 36
.
Upvotes: 2