ISAAC64 RNG in C#

Last updated on April 15, 2025


This is less of a blog post and more of an announcement. I have always had a soft spot for the ISAAC/ISAAC64 pseudo-random number generator.

There was once a time when it was the fastest, but I think that goes to cha-cha now. Anyway it's still pretty fast: in debug mode I get ~17.7 seconds for 500M random numbers on a Ryzen 3950x (with lots of things running), so ~35ns each, not too bad and very suitable for most use cases.

Anyway, I set out to port Bob Jenkins' original C code to C# (with no pointers) in order to finally have my favorite PRNG available for my C# projects. There is one other implementation that I've found, but it is very barebones (but good code and correct); I just wanted something I could drop in and use in any situation- this library handles all bit-widths 8/16/32/64, signed and unsigned, floating-point doubles and even has a random alphanumeric + symbol function. It is the kitchen-sink of PRNGs in just eight hundred lines of code or so.

I know the code could be made a bit faster, but the C# compiler is pretty good with optimization, so in Release mode or in an AOT scenario, I'm confident my code is fast enough. I had an earlier version that used span(s), and it really wasn't any more performant.

What makes this code unique though is that I went full-bore, hog-wild and implemented true double support. It's fully configurable down to the last bit. That's actually the reason I'm even posting about this; a colleague saw it and was floored. He was very complimentary, so I figured I'd share it beyond just the Github repo. I put together a Nuget package too (first time). I've been told it is good enough for simulation work

So if you need a good PRNG that's more advanced than MT or the standard lib, please give it a go. It is standards-conformant, and I have added a battery of new tests (in addition to the standards conformance it's had since day 1), so you can be sure it's professional-grade. 

Github link: https://github.com/nebulaeonline/Isaac64cs

Nuget package: https://www.nuget.org/packages/Isaac64/

Shout out to Mr. Bob Jenkins' original version too: https://burtleburtle.net/bob/rand/isaacafa.html

Please enjoy!

-padawan, 2025