http://www.perlmonks.org?node_id=1054482


in reply to Re^4: Predictable random sequence
in thread Predictable random sequence

Hm. Intriguing. It seems that the Windows versions are doing the 'right thing'. Ie. ignoring the argument when you call rand and returning a random float 'tween 0 .. 1.

To get the equivalent behaviour of the built-in rand where the random float is multiplied by the argument, you need to import the function irand().

I cannot see by inspection why (or even how) you get different behaviour on linux?

It seems it should do the same thing as the Windows install:

sub rand { my ($self, $N) = @_; unless (ref $self) { Math::Random::MT::srand() unless defined $gen; $self = $gen; } return $self->genrand(); } sub irand { my ($self, $N) = @_; unless (ref $self) { $N = $self; Math::Random::MT::srand() unless defined $gen; $self = $gen; } return ($N || 1) * $self->genirand(); }

With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.