How do you randomly select a uniform value from a range of numbers?

Write your question here.
How do you randomly select a uniform value from a range of numbers?
srand(int) to seed the pseudo random generator, seeding with time(0) is usually the best
rand() to get a random number, mod (%) the result to create you range, and + whatever your lower bound is...
Here when I say range I mean upper bound - lower bound

1
2
srand(time(0));
(rand() % 10) + 5; //Random number between 5 and 15 inclusively 
Topic archived. No new replies allowed.