I love the Random helpers in this library, but I'm looking to use them for generative art, and I need a way to create seeded random numbers for consitent, repeatable outputs.
I was wondering if you'd be open to having an extra optional argument added to the functions. For example:
// from...
function bernoulli(p = 0.5) {}
// to...
function bernoulli(p = 0.5, random = Math.random) {}
So for example in p5.js you could do:
let r = Random.bernoulli(0.5, p.random)
Alternatively, the existing random helpers could be refactored to be a class that can be instantiated as well as used as static methods. So you could do:
let random = new Random(p.random)
let r = random.bernoulli()
I love the
Random
helpers in this library, but I'm looking to use them for generative art, and I need a way to create seeded random numbers for consitent, repeatable outputs.I was wondering if you'd be open to having an extra optional argument added to the functions. For example:
So for example in p5.js you could do:
Alternatively, the existing random helpers could be refactored to be a class that can be instantiated as well as used as static methods. So you could do:
Which might be nicer.
This would also make it easy to use libraries like
seedrandom
orseed-random
too.