Source:
int random(int min, int max) {
    int range = (max - min) + 1;
    return (int)(Math.random() * range) + min;
}

Generate a random number from a range.

Pythoneer 6 years ago