A micro JS implementation (112 bytes) of the Mulberry32 pseudorandom number generator.
This library is intended for use in environments where the available storage space is very limited; like blockchains for example. Everything is stripped down to the bare essentials.
// Initialize a random generator for a given seed value
let rand = Pr.ng(1234)
rand()
// => 0.07329497812315822
rand()
// => 0.7034119898453355
rand()
// => 0.9028560190927237
// Re-initialize to start the same sequence again using the same seed value
rand = Pr.ng(1234)
rand()
// => 0.07329497812315822
rand()
// => 0.7034119898453355
rand()
// => 0.9028560190927237
This implementation is borrowed from here and here.
prng.onchain.js is licensed under the terms of the MIT License.