Re: question on rand()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Anna Sidera <sidera.anna@xxxxxxxxx> writes:

>>From this, can I find out when the numbers start repeating? How can I find it? I cannot find the period using
>
> man rand

This question really doesn't have anything to do with gcc.  gcc does not
provide a rand function.  The rand function will come from your C
library, and gcc does not include a C library.

If you are using GNU glibc, which is probably the case if you are using
a GNU/Linux system, then rand is not implemented as a linear
congruential generator, and the period is quite long.  See the source
code.

Ian


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux