Pseudorandom number generator

Does anyone know if the MT19937 option is available for generating random numbers in crystal version 1.4.0? It seems to have been discontinued? The default is Random::PCG32.The only ones I could find from the repo (crystal/src/random at master · crystal-lang/crystal · GitHub) are ISAAC, PCG32, and SECURE

It looks like it was removed in 0.24.0 via Remove MT19937 PRNG by konovod · Pull Request #4636 · crystal-lang/crystal · GitHub. It was moved to GitHub - crystal-lang/crystal-random. It might still work, but hard to say without trying it given it’s been so long.

Is there a reason you need this specific one? Glancing thru the PR/issue, it seems PCG32 is an overall better option.

1 Like

Thanks! There’s some Python code I’m re-writing where numpy uses MT19937 to generate random numbers and I wanted to have reproducible results.