Re: question on rand()

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

 



On Sat, 6 Aug 2011, Andrew Haley wrote:

On 08/06/2011 08:47 AM, Anna Sidera wrote:
Hello,

I am using gcc on a unix machine. Can you tell me how many random numbers can be generated using

rand()

before the random numbers start repeating?

man rand
If it's not there, complain to your unix vendor.
The period is required by posix to be larger or equal to 2^32.

One would hope it has full period, i.e. it generates all RAND_MAX numbers,
but that depends on your system.

One would even hope the period is larger, so the output of rand() is not a deterministic function of its last return value (random generators often keep a hidden state).

--
Marc Glisse


[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