how do you get a random multiple of a given number within a range?

RIght after posting I figured it out…

int randRed = (rand.nextInt(17)+1)*15;

15 goes into 255 17 times, so just multiple a random int between 0 and 17, add 1, and multiply by 15.

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top