On 11/29/05, Chris Wagner <[EMAIL PROTECTED]> wrote: > Has anyone else noticed this? And has anyone at ActiveState noticed it and > if so is anything being done about it? What I'm talking about is the rand() > function that doesn't seem to be so random after all. Atleast 4 times now, > over a multi day period, it has spit out the exact same sequence of numbers. > The script is a mod_perl app that uses rand to generate a random temp file > name. If the name already exists it tries again, using rand(), 10 times. > After that it dies. Now, it seems that a random sequence will never have > the same 10+ digit number twice except maybe sporadically at large > intervals. This rand is acting like it is just regurgitating values from a > list! I put in a call to srand to reinitialize it but it's yet to be seen > whether that will fix it. Like on Monday it might give 1, 2, 3, 4 and then > on Wednesday it might spit out 1, 2, 3, 4 again! The app is not heavily used. > >
perldoc -f srand says srand() is called implicitly the first time rand() is called, so your change shouldn't make a difference. How were you seeding rand() before? Got any code to show us? -- jpg -- jpg _______________________________________________ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs