ml-xsadd
    TypeScript icon, indicating that this package has built-in type declarations

    2.0.0 • Public • Published

    xsadd

    NPM version build status npm download

    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();

    init(seed)

    Reinitialize the generator with a new seed.

    LICENSE

    MIT

    Install

    npm i ml-xsadd

    DownloadsWeekly Downloads

    7,583

    Version

    2.0.0

    License

    MIT

    Unpacked Size

    9.09 kB

    Total Files

    7

    Last publish

    Collaborators

    • mljs-bot
    • stropitek
    • targos
    • lpatiny