4 ms·
Nice. RNGs are getting better and better. Only minor nit: would be nice if they had ready to compile libraries. The ROTL macro is missing, and useful wrappers
by nn3 7y ago
Nice. RNGs are getting better and better.
Only minor nit: would be nice if they had ready to compile libraries. The ROTL macro is missing, and useful wrappers are missing too (like correct limiting to a smaller range) Of course it's trivial to implement, and I like the simplicity of the algorithm to copy it into programs.
- pps43 7y agoIf you need the speed of this PRNG, you probably don't want the overhead of calling a library function. Instead you would implement it in place with AVX-512 or equivalent for the platform you're running on.
- nn3 7y agoFunction calls are very cheap on modern CPUs. The same ILP argument the author makes applies in most cases. And both vectorization and inlining works fine with a function with modern tool chains that do LTO.
- ziotom78 7y ago> The ROTL macro is missing It's missing in the landing page, but the paper [1] linked at the bottom of it provides two implementations: // C #define ROTL(d,lrot) ((d<<(lrot)) | (d>>(8*sizeof(d)-(lrot)))) // C++ template <class uDataT> inline uDataT rotl (uDataT d, unsigned lrot) { return (d<<lrot) | (d>>(8*sizeof(d)-lrot)); } [1] http://www.romu-random.org/romupaper.pdf http://www.romu-random.org/romupaper.pdf