transitive-bullshit/random

Unexpected failsafe in Random constructor

ProgMiner opened this issue · 1 comments

Hello!

I noticed that Random constructor just ignores argument if it is not RNG without any error message:

this.use(new RNGMathRandom())

Maybe it will be more helpful to throw Error or raise some console.error message in this case, to not mislead users.

Second thing is that README suggests use following code to specify seed:

import { Random } from 'random'
import seedrandom from 'seedrandom'

const rng = new Random()
const rng2 = new Random(seedrandom('tinykittens'))

And this isn't correct because of that check in constructor.

Best regards,
ProgMiner