Open mesqueeb opened 3 years ago
Might be hard without introducing a lot of new code as JS doesn't support seeding its PRNG. You could use a package like davidbau/seedrandom as the PRNG in the shuffle, but then you would introduce a package dependency into the project which might not be desirable (based on the fact that there are no deps now, and package lock is disabled in npmrc).
The easiest might be to fork the project and adding the seedable PRNG or copying the index.js
file into your own project and modifying it there.
I think we can make it more general and just add an option to provide your own random number generator function. That way you can use whatever seedable random number generator you want.
At some point, maybe JS will have seeded random built-in and then we could add a specific seed
option: https://github.com/tc39/proposal-seeded-random
I'd love to be able to set a seed to then shuffle an array. Where given the same seed, the result of the shuffle will always return the same result.