Closed tabatkins closed 5 years ago
Note how distribution (such as uniform int) don't specify much. See the libc++ implementation.
Compare:
Note that re-running each compiler gives you the same result, always, but because they have a different STL implementation they don't agree on results because they compute distribution differently.
I'm on board with adding more distributions, but don't think this proposal is the place to do it. The concern with reproducibility across engines is important, but I think that's satisfied by precisely specifying the algorithm used.
Yeah, I'm gonna go ahead and close this. If we want to add multiple algos & control over distribution, that's a great thing to discuss for a v2; for v1 just matching Math.random()'s distribution is good and simple (and settling on one prng algo).
Per @jfbastien, C++ touched somewhat, but ineffectively, on letting the user control the range/distribution of random numbers. Lack of good specification means that, while the ordinary generator is consistent between impls, the alternate distributions are not. Should we allow specifying this?
Like #5, I think this is a valuable addition, but is equally valuable for
Math.random()
. (The number of times I've written arandInt()
function for myself, or faked auniform()
by averaging threeMath.random()
calls...) Like #5, I'd like to defer this to a separate proposal for upgrading both random functions, unless the committee decides they'd like to broaden this to alteringMath.random()
too.