Package Exports
- ml-xsadd
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (ml-xsadd) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
ml-xsadd
JavaScript implementation of the XORSHIFT-ADD (XSadd) pseudo random number generator
Based on the C code from https://github.com/MersenneTwister-Lab/XSadd
Installation
$ npm install ml-xsadd
API
new XSadd([seed])
Creates a new XSadd instance. Seed is an optional integer that defaults to Date.now()
.
getUint32()
Returns a 32-bit integer r (0 <= r < 2^32)
getFloat()
Returns a floating point number r (0.0 <= r < 1.0)
random()
Like getFloat()
but dynamically bound to the XSadd
instance.
You can use this function externally, like Math.random
:
var XSadd = new XSadd();
var random = xsadd.random;
var number = random();