bgamari / mersenne-random-pure64 Goto Github PK
View Code? Open in Web Editor NEWGenerate high quality pseudorandom numbers purely using a Mersenne Twister
License: Other
Generate high quality pseudorandom numbers purely using a Mersenne Twister
License: Other
I was surprised to find that randomRs
failed with an exception because of the RandomGen
default implementation based on split
, which is not implemented for PureMT
.
This got me curious about why it wasn't implemented, and if it could be. Is there some more insight about the state of split
?
I did a few empirical tests using a naive implementation (very naive: split g = (g, pureMT $ fst $ randomWord64 g)
) on random sequences of 50k elements, which appears to show an expected correlation of zero (t(99)=-0.29, 95% CI=[-0.0010, 0.00075], p=0.7694) and the same maximum cross-correlation as for independent streams (t(198)=-0.107, CI=[-5.138e-4,4.608e-4], p=0.9146). This makes me think a similar method, perhaps with some mixing, would be acceptable.
Otherwise, would a method such as this be appropriate? http://www.math.sci.hiroshima-u.ac.jp/m-mat/MT/JUMP/
$ stack build mersenne-random-pure64-0.2.1.0 --resolver lts-6.13
Run from outside a project, using implicit global project config
Using resolver: lts-6.13 specified on command line
random-1.1: configure
random-1.1: build
random-1.1: copy/register
mersenne-random-pure64-0.2.1.0: download
mersenne-random-pure64-0.2.1.0: configure
mersenne-random-pure64-0.2.1.0: build
Completed 2 action(s).
-- While building package mersenne-random-pure64-0.2.1.0 using:
/Users/adam/.stack/setup-exe-cache/x86_64-osx/setup-Simple-Cabal-1.22.5.0-ghc-7.10.3 --builddir=.stack-work/dist/x86_64-osx/Cabal-1.22.5.0 build --ghc-options " -ddump-hi -ddump-to-file"
Process exited with code: ExitFailure 1
Logs have been written to: /Users/adam/.stack/global-project/.stack-work/logs/mersenne-random-pure64-0.2.1.0.log
Configuring mersenne-random-pure64-0.2.1.0...
Building mersenne-random-pure64-0.2.1.0...
Preprocessing library mersenne-random-pure64-0.2.1.0...
clang: warning: optimization flag '-finline-functions' is not supported
clang: warning: argument unused during compilation: '--param max-inline-insns-single=1800'
clang: warning: optimization flag '-finline-functions' is not supported
clang: warning: argument unused during compilation: '--param max-inline-insns-single=1800'
[1 of 4] Compiling System.Random.Mersenne.Pure64.Base ( .stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/System/Random/Mersenne/Pure64/Base.hs, .stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/System/Random/Mersenne/Pure64/Base.o )
[2 of 4] Compiling System.Random.Mersenne.Pure64.Internal ( System/Random/Mersenne/Pure64/Internal.hs, .stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/System/Random/Mersenne/Pure64/Internal.o )
[3 of 4] Compiling System.Random.Mersenne.Pure64.MTBlock ( System/Random/Mersenne/Pure64/MTBlock.hs, .stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/System/Random/Mersenne/Pure64/MTBlock.o )
[4 of 4] Compiling System.Random.Mersenne.Pure64 ( System/Random/Mersenne/Pure64.hs, .stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/System/Random/Mersenne/Pure64.o )
/private/var/folders/sd/d9hgvrbx4dggjz1bxkpw5qgc0000gn/T/stack56422/mersenne-random-pure64-0.2.1.0/System/Random/Mersenne/Pure64.hs:64:50:
Not in scope: ‘diffTimeToPicoseconds’
I am using ghc-8.10.0.20191121 , and I get
Configuring mersenne-random-pure64-0.2.2.0...
...
[4 of 4] Compiling System.Random.Mersenne.Pure64 ( System/Random/Mersenne/Pure64.hs, dist/build/System/Random/Mersenne/Pure64.p_o )
cc: error: max-inline-insns-single=1800: No such file or directory
`cc' failed in phase `C Compiler'. (Exit code: 1)
The cabal file has
library
..
cc-options:
..
-fno-strict-aliasing --param max-inline-insns-single=1800
The command line that calls the C compiler has this:
/opt/ghc/ghc-8.10.0.20191121/bin/ghc -c -fPIC ... -optc-fno-strict-aliasing -optc--param '-optcmax-inline-insns-single=1800' ...
Perhaps the behaviour of ghc changed?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.