Mail Archives: djgpp/1998/03/06/04:45:38
I wonder what does these libc functions do ?
In the libc reference info file there are 3 random functions.
They are rand, random, srandom.
The function "rand(unsigned int)" is not found but there is a prototype
in "stdlib.h"
Anyway the info file says about the function srandom like this
> srandom
> =======
> Syntax
> ------
> #include <stdlib.h>
> int srandom(int seed);
>
> Description
> -----------
> This function initialized the random number generator (random.).
> Passing the same SEED results in `random' returning predictable
> sequences of numbers.
>
> Return Value
> ------------
> Zero.
>
> Example
> -------
> srandom(45);
What does this mean. I can't get any idea from the example.
So I tried to find out the difference before calling the function
"srandom"
I tried several times but I couldn't find any difference!
The return value of "random( )" was unpredictable all the time, before
and after calling the functions "srandom". Please help me how to use
this function.
- Raw text -