I need to generate a specific set of random numbers. For instance,I need a random number between 4-7. I understand how to generate a random number from 0 - what ever, but do not know how to generate a specific set of random numbers from any integer range such as the example above(4-7). Please help if you can, thanks.
you could get the diff 7-4 = 3, and get a random number 0-3... int x = rand()%4 (after you seed of course. Then you just adjust it like so: x+4, then the number will be between 4 and 7