At 10:57 -0700 2003.09.11, Bill Becker wrote:
>It is not rediculous to expect a pseudo-random number generator to
>behave differently! I believe that is, indeed what rand() is supposed
>to be. You go in with a consistent seed across all platforms, it
>should return consistent results across same.
>
>As I said before, the original poster (Louis?) should contact the
>people who ported the windoze version of Perl.

rand() is not documented to return any particular results, as best I can
tell.  As such, I think expecting/demanding any particular results is
unreasonable.

Perl has long had different types of rand() algorithms on different
platforms, often using one supplied by the system, and if one is not
supplied, then some extra one.  See all the config options in
config.h/config.sh for RAND, including different functions, different
number of bits, etc.

For example, on Mac OS X, the Drand01() macro is set to call the system's
drand48() (see man drand48).  On Windows, however, it is set
(rand()/(double)((unsigned)1<<RANDBITS)), where randbits is 15, as
apparently no drand48() function is supplied by the system.

I can't say why Windows is configured like that (see Config.pm for these
values, I am reading from perl-5.8.0/win32/config*), but it is apparently
intentional, and the porters of perl aer obviously well aware that
different platforms use different implementations for rand(), which would
necessarily result in different values returned by rand().

-- 
Chris Nandor                      [EMAIL PROTECTED]    http://pudge.net/
Open Source Development Network    [EMAIL PROTECTED]     http://osdn.com/

Reply via email to