On Sat, Aug 6, 2011 at 12:53 PM, Anna Sidera <sidera.anna@xxxxxxxxx> wrote: > The following program: > > [SNIP] > > From this, can I find out when the numbers start repeating? How can I find it? I cannot find the period using > This is a crypto question ;) If you are attacking an LCG, see Joan Boyar's paper or constructing alternate LCG from observations which creates the same output. If the online poker sites have read Wagner's (et al) paper on fair deals, you will probably be out of luck. Finally, sci.math or sci.crypt might be a better forum. Jeff > ----- Original Message ----- > From: Marc Glisse <marc.glisse@xxxxxxxx> > Date: Saturday, August 6, 2011 7:34 pm > Subject: Re: question on rand() > >> 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 >> >