Hello!
Is there any way to use the rand() function properly to give me the results i want between the max and min limit numbers i set?
For example i want to print random numbers between 500 and 1000.
Till now the only usage of rand() i know is to randomize numbers between 0 and the max limit i will choose
rand()%1000 (it gives numbers from 0 to 1000)
Is there any idea/solution about that?
Thank you in advance!!
3 replies to this topic
#1
Posted 27 April 2010 - 05:49 AM
|
|
|
#2
Posted 27 April 2010 - 06:25 AM
I think this thread will give you the solution you are looking for.
Visit Grandpa's Forums, a social networking forum, with family-oriented arcade games, blogs, discussion forums, and photo albums.
#3
Posted 27 April 2010 - 09:48 AM
I don't know what the thread says, but if you do (rand()%500) + 500; then it will give you a random number between 500 and 1000?
^_^
If this is not right, I apologize for the waste of time
^_^
If this is not right, I apologize for the waste of time
#4
Posted 27 April 2010 - 12:00 PM
Ancient Dragon said:
I think this thread will give you the solution you are looking for.
I found something in the thread you linked and i think it might help !Thanks dude!
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users


Sign In
Create Account

Back to top









