new Random vs random.clone
Badestrand opened this issue · 3 comments
Badestrand commented
Hi!
First, thanks for this super cool library.
I just ran into an issue which may just be an issue of the documentation.
When working with seeds, I expected new Random(seedrandom('tinykittens'))
to work the same as random.use(seedrandom('tinykittens'))
or random.clone(seedrandom('tinykittens'))
.
But appearently new Random
doesn't seed correctly?
console.log('rng test random..')
for (let i=0; i<3; ++i) {
const prng = new Random(seedrandom('my-seed'))
console.log(prng.float())
}
// =>
// 0.6724578711199012
// 0.014330871501025522
// 0.16677254682291287
If this is expected behaviour then I think the documentation should be adjusted near the text You can also instantiate a fresh instance of Random
.
transitive-bullshit commented
@Badestrand this definitely looks like a bug and is unintended behavior.
Thanks for reporting it 🙏
lespin commented
Same problem here. Could you tell if this module is maintained ?