Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MersenneTwister output depends on 32/64-bit architecture #5999

Closed
rickhg12hs opened this issue Mar 1, 2014 · 7 comments
Closed

MersenneTwister output depends on 32/64-bit architecture #5999

rickhg12hs opened this issue Mar 1, 2014 · 7 comments
Labels
domain:randomness Random number generation and the Random stdlib

Comments

@rickhg12hs
Copy link
Contributor

Xref: #5993

$ ./julia -e 'versioninfo()'
Julia Version 0.3.0-prerelease+1794
Commit 4dfbecc* (2014-03-01 09:22 UTC)
Platform Info:
  System: Linux (i686-redhat-linux)
  CPU: Genuine Intel(R) CPU           T2250  @ 1.73GHz
  WORD_SIZE: 32
  BLAS: libopenblas (DYNAMIC_ARCH NO_AFFINITY)
  LAPACK: libopenblas
  LIBM: libopenlibm
$ make test-random
    JULIA test/random
     * random
exception on 1: ERROR: test failed: rand(rng) - 0.07749284875576845 < 0.01
 in error at error.jl:21
 in default_handler at test.jl:19
 in do_test at test.jl:39
 in runtests at /usr/local/src/julia/julia/test/testdefs.jl:5
 in anonymous at multi.jl:629
 in run_work_thunk at multi.jl:590
 in remotecall_fetch at multi.jl:663
 in remotecall_fetch at multi.jl:678
 in anonymous at task.jl:1309
while loading random.jl, in expression starting on line 14
ERROR: test failed: rand(rng) - 0.07749284875576845 < 0.01
 in error at error.jl:21
 in default_handler at test.jl:19
 in do_test at test.jl:39
 in runtests at /usr/local/src/julia/julia/test/testdefs.jl:5
 in anonymous at multi.jl:629
 in run_work_thunk at multi.jl:590
 in remotecall_fetch at multi.jl:663
 in remotecall_fetch at multi.jl:678
 in anonymous at task.jl:1309
while loading random.jl, in expression starting on line 14
while loading /usr/local/src/julia/julia/test/runtests.jl, in expression starting on line 34

make[1]: *** [random] Error 1
make: *** [test-random] Error 2
$ ./julia -e '@show rand(MersenneTwister(0))'
rand(MersenneTwister(0)) => 0.8236475079774124
$ 
@jiahao jiahao closed this as completed in ca73d0d Mar 1, 2014
@jiahao
Copy link
Member

jiahao commented Mar 1, 2014

Reopening as an issue about MersenneTwister not generating platform-independent sequences.

@jiahao jiahao reopened this Mar 1, 2014
@andreasnoack
Copy link
Member

Regarding @StefanKarpinski's comment, the discussion is here and his fix is here. The fix works as long as you set the seed through srand but not if you set it directly in MersenneTwister. I guess @Stefan's solution can be used also in the MersenneTwister constructor but maybe we should start by discussing how to set the seed when allowing different rngs.

@StefanKarpinski
Copy link
Sponsor Member

I think we should probably make all RNG constructors behave similarly. We can probably generalize the make_seed method to generate different kinds of seed arrays, or we can just reinterpret the ones it produces to feed different RNGs.

@jperla
Copy link

jperla commented Mar 2, 2014

Can we get Travis CI to run all of the unit tests on 32-bit machines too?

jperla pushed a commit to jperla/julia that referenced this issue Mar 2, 2014
jperla pushed a commit to jperla/julia that referenced this issue Mar 2, 2014
jperla pushed a commit to jperla/julia that referenced this issue Mar 2, 2014
@staticfloat
Copy link
Sponsor Member

@jperla unfortunately, that's a feature they're still working on.

@jperla
Copy link

jperla commented Mar 2, 2014

What do you recommend as the best way for me to test out some changes I'm making? (I don't have a 32-bit machine). Can I force build this as 32-bit to test?

jperla pushed a commit to jperla/julia that referenced this issue Mar 2, 2014
As mentioned in issue JuliaLang#5999, reproduce the solution in 67f6fee for the MersenneTwister.

Note that users on 64-bit architectures will see their randomness change with no change in their seed.
jperla pushed a commit to jperla/julia that referenced this issue Mar 2, 2014
As mentioned in issue JuliaLang#5999, reproduce the solution in 67f6fee for the MersenneTwister.

Note that users on 64-bit architectures will see their randomness change with no change in their seed.
jperla pushed a commit to jperla/julia that referenced this issue Mar 3, 2014
As mentioned in issue JuliaLang#5999, reproduce the solution in 67f6fee for the MersenneTwister.

Note that users on 64-bit architectures will see their randomness change with no change in their seed.
@rickhg12hs
Copy link
Contributor Author

This seems to be working now.

@ViralBShah ViralBShah added the domain:randomness Random number generation and the Random stdlib label Nov 22, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
domain:randomness Random number generation and the Random stdlib
Projects
None yet
Development

No branches or pull requests

7 participants