This is a javascript implementation of the ISAAC CSPRNG.
It's ~261.95% faster than the readable implementation by rubycon at tumbling, and ~231.88% faster at returning random numbers.
Due to the focus on speed ISAACJS has not been made with the intention of being readable.
I have additionally implemented ISAAC-64 using BigInt. Please for the love of god don't actually use it; it's a PoC, slow, and ridiculous.
ISAAC-64-fast uses a simulated 64-bit integer object by having a hi and lo 32-bit integer. It's 3x faster than the BigInt version. It's still too slow to be useful and I don't trust my hi/lo arithmetic.
Create an instance of ISAAC with or without a seed.
varrng=newISAAC();//No seedvarrng=newISAAC(newUint32Array(ISAAC.prototype.SIZE));//Zero seedvarrng=newISAAC(ISAAC.StringToUintArray("This is a test"));//Text seedTumble it an arbitrary amount of times
rng.Isaac();//Tumble oncefor(vari=0;i<5;i++)rng.Isaac();//Tumble five timesTada! Go get yourself some random numbers!
rng.Rand();//Will get the next available random 32bit unsigned integer and re-tumble it if it has run outrng.rsl[0];//Alternatively you can access the internal result arrayTested and working in Chrome, Firefox, IE11, and Edge.
This project is licensed under the CC0 license, meaning it is effectively public domain.