pdpinch@husc.harvard.edu (Peter Pinch) writes: } I'm using MacPERL to develop some PERL scripts which are eventually uploard } to a UNIX web server. I've noticed some odd behavior in the rand() function } between the two platforms. } } IN MacPERL, I was able to user rand() to create a random number without } first using srand() to seed the random numbers. Everything worked fine } until I uploaded it onto the web server. Unix requires srand() first, } otherwise I get the same number every time. But when I added srand() to my } Mac version, it no longer worked, giving me the same number every time. } } Has anyone else experienced this? Why is it happening? Because the "random numbers" produced by a "random number generator" aren't random, they are "randomly distributed". Start with the same seed, and you'll get exactly the same "random" numbers. Apparently the Unix version starts with the same seed unless you call srand (this is what perlfunc.html says should happen, although this doesn't seem very useful behavior), while MacPerl doesn't seem to. I don't get the behavior you describe using BigMacPerl 5.10b2r2 on my 68030 Powerbook. I get different numbers whether or not I use srand (without an argument, of course), but if you want portability with the symptoms you describe, try putting: srand unless $^O eq "MacOS"; #if you're using MacPerl 5.10 or use Config; srand unless $Config{'osname'} eq "MacOS"; #if you're using 5.07 } } ----------- } Peter Pinch } Harvard University } } } --- -------- Paul J. Schinder NASA Goddard Space Flight Center, Code 693, Greenbelt, MD 20771 USA schinder@pjstoaster.pg.md.us