Open GrosSacASac opened 3 years ago
@ljharb why not? How do you really know an API is good until you try it out?
Anyway, regardless of the API, would love to have a saveable/restorable random seed generator. If anybody knows of one out there....
@cowboyd you can write a function that provides the same API without needing to actually polyfill anything.
@ljharb agreed. What I was looking for would perhaps be more accurately called a maybefill.
In any event, for those coming here, I was able to accomplish serializing and deserializing the random seed state using the alea
npm package https://github.com/coverslide/node-alea
The seed function has an importState()
and exportState()
that lets you continue from anywhere in the sequence of pseudo random numbers.
I hope not; polyfills shouldn’t really exist or be used until stage 3, except as explanatory tools for the proposal itself.