Search code examples
javarandomfloorceil

How do I randomly generate a number between 75 - 100%?


I know how to do it between 0 and 100, but I can I set the floor?

This is how I do 0 - 100..

int randomNum = (int) Math.ceil(Math.random() * 100);

Solution

  • Generate a random number from 0 to 25 and add 75. :)