|
-
September 17th, 1999, 10:44 AM
#1
how can i do it??? urgent.
Hi guys i just can't write the rand() to return specific number from 0 up to 6.
Can anybody help me out.
Thanks alot.
-
September 17th, 1999, 10:54 AM
#2
Re: how can i do it??? urgent.
Try this
int random = (int)((double)rand()/(double)RAND_MAX * 6.0);
This should give random numbers from and including 0 up to and
including 6.
-
September 25th, 1999, 02:31 AM
#3
Re: how can i do it??? urgent.
Why not just:
int randomValue = rand() % 6;
That's better than casting all over the place.
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
|