Random random = new Random();
int randomx = random.Next(0, 240);
This is the way I get my random number, from 0 to 240, how can get only integrals that divide with 5? (0 included)
0, 5, 10, 15, 20, 25 .. 240
How about this:
Random random = new Random();
return random.Next(0, 48) * 5;
Or, if you need 240 included, as your list indicates:
Random random = new Random();
return random.Next(0, 49) * 5;
Here's one (very bad, hence the community wiki) way to do it:
Random random = new Random();
int randomx = 1;
while ((randomx % 5) > 0)
randomx = random.Next (0,240);
:-)
Feel free to downvote this answer into oblivion. It's really just to prevent others from posting it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With