Closed spoike closed 6 years ago
I'm not intending to deal with that, no. "Save-scumming" would only be possible if you switched browsers between saves. Within a single browser using the same seed will generate the same sequence.
(The main use-case I have just needs the sequence to be consistent within a single page lifetime.)
This is related to #1, where an option to choose a specific algorithm seems interesting, but can be addressed completely separately for both this and Math.random()
. (Doing it for only one seems wrong.)
I think this is worth getting opinions on in committee FWIW. Is there a significant downside to picking a single specific algorithm? If not, it sure would be nice to get reliable cross-browser results.
No downsides, no, it's just feature creep - it's not strictly necessary for my proposal so I'm trying to avoid it for v1. Like I said, anything we do in this space should apply equally to Math.random()
.
I would argue that we can leave Math.random() as it is and still make the new predictable/seedable random number generator feature predictable cross-browser.
That seems inconsistent?
Why? Math.random() is not predictable ever, whether cross-browser or within the same browser. Whereas your API would be predictable given a seed---making it predictable cross-browser just seems natural for interop.
Hm, I suppose so. Okay, that does sound reasonable.
All right, proposal updated to specify that there will be a specific required generating algo.
Will this spec contain what RNG algorithm is used so it is consistent among user agents or should it be somehow configured?
E.g. if you're implementing a game that relies on the random seed should generate the same sequence of random numbers. You'd expect it to give the same sequence across the browsers (to avoid some "save-scumming" a'la XCOM, etc).