xoroshirojs128plus

Node.js version of the PRNG xoroshiro128plus

Usage no npm install needed!

<script type="module">
  import xoroshirojs128plus from 'https://cdn.skypack.dev/xoroshirojs128plus';
</script>

README

xoroshirojs is a nodejs addon for http://xorshift.di.unimi.it/xoroshiro128plus.c. For more information see http://xorshift.di.unimi.it/. It's currently only tested on linux.

Usage

npm i --save xoroshirojs128plus

var xoroshirojs = require('xoroshirojs128plus')

var ret = xoroshirojs.seed(10, 11)

for (var i = 0; i < 5; i++) {
    ret = xoroshirojs.next()
    console.log(ret)
}

To seed the PRNG, we need a 64 bit unsigned integer. JS does not have a safe native 64 bit unsigned integer so instead we give 2 32 bit unsigned integers xoroshirojs.seed(10, 11). Once seeded, use val result = xoroshirojs.next() to get an array of 2 32 bit unsigned integers since, again, xoroshirojs returns a 64 bit value.

Thanks

Thanks to Sebastiano Vigna for splitmix64 Thanks to David Blackman and Sebastiano Vigna for xoroshiro128plus