|
-
Dec 30th, 2002, 04:26 PM
#1
Thread Starter
Fanatic Member
Random Number
quick formula.
I need to get a random number between a High and a low.
what's the formula??
It Never Fails. Everytime I try to make a program idiot proof, the world makes a better idiot.
-
Dec 30th, 2002, 05:40 PM
#2
Frenzied Member
Code:
for(i=0;i<10;i++) printf("%d\n",rand() ); // print some random numbers
-
Dec 30th, 2002, 07:16 PM
#3
with [min, max] being an inclusive range
Code:
inline int getrandfromto(int min, int max)
{
return ((rand() % (max-min+1))+min);
}
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|