> hi everyone, just a quicky, does anyone know how to make a random
number?
> i've tried:
>
> messpool = rand() %12;
>
at the beginning of your main program, put the following:
srand(time(0));
and don't forget at beginning of the same file:
#include <stdlib.h>
#include <time.h>
This works for me. srand(time(0)) takes the current time and seeds the
random numbers generator with it. After that, you can use rand() to
get a series of pseudo-random numbers (depending on the seed value
used with srand())
> but that comes up with the same number everytime so i must be way
off. if
> anyone could help i would be greatful.
>
|