in reply to Re^2: Predictable random sequence
in thread Predictable random sequence
but seems it's not cleared in documentation that sequence is always same for same seed.
It does, else it wouldn't be the Mersenne Twister.
Update: Results from a 32-bit and a 64-bit build of Perl (on windows):
C:\test>\perl32\bin\perl -MMath::Random::MT=rand,srand -le"srand(1); p +rint rand(12345) for 1 .. 50" 0.417021998437122 0.99718480813317 0.720324489288032 0.932557361200452 + 0.000114381080493331 0.128124447772279 0.302332567749545 0.999040515394881 0.14675589255057 +3 0.236088976264 0.0923385955393314 0.39658072614111 0.186260211281478 0.38791074021719 +4 0.345560725079849 0.66974604036659 0.396767468657345 0.935539072612301 0.538816731888801 + 0.846310918219388 0.419194519054145 0.313273512991145 0.685219500679523 0.52454816270619 +6 0.204452248988673 0.44345289375633 0.878117437008768 0.22957722004503 0.027387595968321 +0.534413907211274 0.670467507559806 0.913962022401392 0.417304804315791 0.45720480917953 + 0.558689827332273 0.430698570096865 0.140386936953291 0.939127794932574 0.19810148328542 +7 0.778389235492796 0.800744566367939 0.715970510849729 0.968261571833864 0.80275750323198 +7 0.313424184685573 0.0928008102346212 0.692322616931051 0.518152548233047 0.8763891460839 +66 0.865020245313644 C:\test>\perl64\bin\perl -MMath::Random::MT=rand,srand -le"srand(1); p +rint rand(12345) for 1 .. 50" 0.417021998437122 0.99718480813317 0.720324489288032 0.932557361200452 + 0.000114381080493331 0.128124447772279 0.302332567749545 0.999040515394881 0.14675589255057 +3 0.236088976264 0.0923385955393314 0.39658072614111 0.186260211281478 0.38791074021719 +4 0.345560725079849 0.66974604036659 0.396767468657345 0.935539072612301 0.538816731888801 + 0.846310918219388 0.419194519054145 0.313273512991145 0.685219500679523 0.52454816270619 +6 0.204452248988673 0.44345289375633 0.878117437008768 0.22957722004503 0.027387595968321 +0.534413907211274 0.670467507559806 0.913962022401392 0.417304804315791 0.45720480917953 + 0.558689827332273 0.430698570096865 0.140386936953291 0.939127794932574 0.19810148328542 +7 0.778389235492796 0.800744566367939 0.715970510849729 0.968261571833864 0.80275750323198 +7 0.313424184685573 0.0928008102346212 0.692322616931051 0.518152548233047 0.8763891460839 +66 0.865020245313644
You should get the same everywhere regardless of platform or build.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Predictable random sequence
by vsespb (Chaplain) on Sep 17, 2013 at 15:10 UTC | |
by BrowserUk (Patriarch) on Sep 17, 2013 at 15:32 UTC | |
by BrowserUk (Patriarch) on Sep 17, 2013 at 15:50 UTC | |
by choroba (Cardinal) on Sep 17, 2013 at 16:06 UTC | |
by BrowserUk (Patriarch) on Sep 17, 2013 at 16:31 UTC | |
by vsespb (Chaplain) on Sep 18, 2013 at 15:40 UTC | |
|
Re^4: Predictable random sequence
by vsespb (Chaplain) on Sep 18, 2013 at 15:38 UTC | |
by BrowserUk (Patriarch) on Sep 18, 2013 at 15:59 UTC |