rand help!!

I'm trying to find an algorithm in order to pick a number from a range (5,x-5) while inputing the x.. But i really don't understand how rand works can you help me?
Basically:

 
rand() % 10 + 1


With this you are getting a number from 1 to 10.
So:

 
rand() % range + start


PD: try to google it, I don't think you really need to post here!
Topic archived. No new replies allowed.