Mail Archives: djgpp/1998/06/16/20:57:31
On Wed, 10 Jun 1998, Nicolas Blais wrote:
> Hi, the function below seams to always give me the same set of numbers
> in R_C everytime I run it, can it be fixed?
>
> srandom(clock()/CLOCKS_PER_SEC);
AFAIK, clock() returns the number of clocks/ticks/whatever since the
program was invoked. This would be the same every run. You would want to
use time(NULL); instead, as this
will give you the number of seconds since 1 jan 1970 or something. Your
not likely to get the same number twice though.
Owen Butler
> int R_C = random() / (RAND_MAX / 255 + 1);
>
> Thank you,
> Nicolas Blais
>
>
>
- Raw text -