Source:
unsigned int
random(unsigned int min, unsigned int max) {
       double scaled = (double)rand()/RAND_MAX;
       return (max - min +1)*scaled + min;
}

Generate a random number from a range.

Pythoneer 3 years ago