1.0.2 • Published 4 years ago

lcg-bytes v1.0.2

Weekly downloads
1
License
MIT
Repository
github
Last release
4 years ago

Fast pseudo-random bytes generation without dependencies

Example

Math.random will be used as a seed

let {randomBytes} = require("lcg-bytes")
randomBytes(5);
// > randomBytes(5)
// Uint8Array(5) [ 226, 134, 254, 127, 62 ]

With custom seed

// rnd_uint32 is a Math.random()-based seed
let {lcg_parkmiller, rnd_uint32} = require("lcg-bytes")
let rnd = lcg_parkmiller(rnd_uint32());
> rnd.randomBytes(5)
Uint8Array(5) [ 200, 24, 194, 39, 184 ]

Benchmark

const benchmark = require("lcg-bytes/benchmark");
benchmark();
1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago