Fastest C# Random Number Generator: XorShift+

Fastest C# Random Number Generator: XorShift+

I constantly find myself needing pseudo-random numbers for machine learning projects. In most cases, the built-in .NET Random class is perfect for this type of thing. For high-performance or type-specific application… not so much. It’s bad enough that Random is limited to a handful of types. It’s even worse from a performance standpoint. For those who need to generate pseudo-random data hundreds of millions of times per second, Random simply won’t cut it.

When implemented, XorShift+ is one of the fastest C# random number generator out there. It even passes the BigCrush statistics tests, meaning it generates a superb distribution of pseudo-random numbers.

Continue reading “Fastest C# Random Number Generator: XorShift+”