in reply to rand and srand across builds and platforms?

I get the same results as davis (perl 5.6.1 on Red Hat Linux 8):

$ perl -le"srand(1); print rand for 1 .. 10" 0.0416303447718782 0.454492444728629 0.834817218166915 0.3359860301452 0.565489403566136 0.00176691239174431 0.18758951699996 0.990434079937664 0.750497133229519 0.366273638152734

A truely compassionate attitude towards other does not change, even if they behave negatively or hurt you

—His Holiness, The Dalai Lama

Replies are listed 'Best First'.
Re^2: rand and srand across builds and platforms?
by BrowserUk (Patriarch) on Mar 08, 2005 at 15:45 UTC

    Interesting. Maybe it comes down to the rand() function provided by the C-libraries? Would that be consistant across different GCC installs?


    Examine what is said, not who speaks.
    Silence betokens consent.
    Love the truth but pardon error.

      That sounds likely, though I can neither confirm nor deny, given that I have little to no understanding of the underlying algrothim used to generate random numbers.


      A truely compassionate attitude towards other does not change, even if they behave negatively or hurt you

      —His Holiness, The Dalai Lama

      Consistent across 5.8.0 on RH9 (glibc-2.3.2-27.9.7) and 5.6.1 on RHEL 2.1 WS (glibc-2.2.4-31.7) (i.e. I get the same sequence as above).