Le 03/04/2017 à 15:44, Jaime Fernández del Río a écrit : > This > <https://github.com/JuliaLang/julia/blob/7fb758a275a0b4cf0e3f4cbf482c065cb32f0011/doc/src/stdlib/numbers.md#L116> > says > that Julia uses this library > <http://www.math.sci.hiroshima-u.ac.jp/%7Em-mat/MT/SFMT/#dSFMT>, which > is different from the home brewed version of the Mersenne twister in > NumPy. The second link I posted claims their speed comes from > generating double precision numbers directly, rather than generating > random bytes that have to be converted to doubles, as is the case of > NumPy through this magical incantation > <https://github.com/numpy/numpy/blob/master/numpy/random/mtrand/randomkit.c#L514>. > They also throw the SIMD acronym around, which likely means their > random number generation is parallelized. > > My guess is that most of the speed-up comes from the SIMD > parallelization: the Mersenne algorithm does a lot of work > <https://github.com/numpy/numpy/blob/master/numpy/random/mtrand/randomkit.c#L221> > to > produce 32 random bits, so that likely dominates over a couple of > arithmetic operations, even if divisions are involved. Thanks for the feedback.
I'm not good in enough in reading Julia to be 100% sure, but I feel like that the random.jl (https://github.com/JuliaLang/julia/blob/master/base/random.jl) contains a Julia implementation of Mersenne Twister... but I have no idea whether it is the "fancy" SIMD version or the "old" 32bits version. best, Pierre
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@python.org https://mail.python.org/mailman/listinfo/numpy-discussion