Can someone plz email me the code on a random number. I know its something like srand(?????
plz email me it at [email protected]
ttttthanks
Printable View
Can someone plz email me the code on a random number. I know its something like srand(?????
plz email me it at [email protected]
ttttthanks
Before Quzah finds this I would do a search for say, off the top of my head, srand.
how about random() with randomize()?
well..do this
#include <time.h>
#include <stdlib.h>
int main()
{
srand((usigned int)(time)(NULL)) // seeds it so get diff. num each time
int x;
x = rand() % 6 // this will make a random number 0-5, change the 6 to anythin you like
return 0;
}
i spell something wrong on the last post
#include <time.h>
#include <stdlib.h>
int main()
{
srand((unsigned int)(time)(NULL)); // seeds it so get diff. num each time
int x;
x = rand() % 6; // this will make a random number 0-5, change the 6 to anythin you like
return 0;
}
And easier way to seed off of time is:
srand(time(NULL));