Positivity is a Node.js module intended to both (sort of) replicate Python's Random module and implement ISAAC for cryptographic security and speed. Currently a work in progress, and should not be used in production.
Positivity implements the ISAAC pseudo-random number generator, which is cryptographically secure. Seeds are pulled from system-specific sources; /dev/urandom on UNIX-based systems and CryptGenRandom on windows.
When tested with Benchmark.js, Positivity has an advantage of several hundred thousand more operations per second over the crypto module.
Build, require, and then positivity.Initialize()
All methods (except for Initialize) have an optional callback parameter. If this parameter is not included, methods are not guaranteed to be asynchronous.
Initializes the random number generator. Should be called before any functions are used.
Returns a random integer between -2147483647 and 2147483647.
Returns a random floating point number between -1 and 1.
Returns a random integer between min
and max
.
Returns a random floating point number between min
and max
.
Returns a random element from the array arr
.
Returns size
random samples from array arr
.
Returns arr
after being shuffled.
Returns a buffer with length
random bytes.