generated from tc39/template-for-proposals
-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Description
The current proposal has Random.bigint()
, which generates a uniform BigInt in a range. All the rest of the proposed number-returning functions, particularly the non-uniform distributions like Random.normal()
, return Numbers.
In #8, tho, @michaelficarra mentions wanting non-uniform distributions over BigInts. How can we best address this?
- Should we have
normalBigInt()
/etc variants? - The alternative is just saying "eh,
BigInt(Math.round(Random.foo(...)))
is good enough".
Are the use-cases for non-uniform BigInt distributions outside of the ±2^53 range large enough to need an API solution? Is it sufficient to just shift your distribution to within the SAFE_INTEGER range, generate a Number, convert to BigInt, then shift back? The only weakness is if you need integer-accurate values where the whole meaningful range is wider than 2^54.
js-choi
Metadata
Metadata
Assignees
Labels
No labels