Closed thearthouse closed 2 years ago
Looks like it will never be bigger 26777215 (which is 10**7 + 16777216 - 1), while it should produce such numbers almost half of times. (it is only reproducisble when platform supports native bigints)
looks like it will never be bigger 26777215 (which is 10**7 + 16777216 - 1) only when BigInt is supported
also tested bigInt.randBetween(BigInt("16777216"), BigInt("33554431")); result is same
seems, https://github.com/peterolson/BigInteger.js/blob/master/BigInteger.js#L1181 this line should have digits[i] + 1:
- var top = restricted ? digits[i] : BASE;
+ var top = restricted ? digits[i] + 1 : BASE;
seems, https://github.com/peterolson/BigInteger.js/blob/master/BigInteger.js#L1181 this line should have digits[i] + 1:
- var top = restricted ? digits[i] : BASE; + var top = restricted ? digits[i] + 1 : BASE;
i change that and its working fine , will be there any problem on high integers like 2**120
@Yaffle Can you make a pull request? I'll merge it in
ok
@peterolson a test is falling and I don't know how to resolve it :-)
Which test?
@peterolson , i have added more ranges to "is within 10% of uniform distribution (this test is probabilistic and has a small change of failing)"
@peterolson see https://github.com/peterolson/BigInteger.js/pull/222/files
@peterolson can you answer will any problem on high numbers?
@peterolson I have created a new pull request, please look - https://github.com/peterolson/BigInteger.js/pull/223/files
Fixed with #223.
why it's never hit a number 33185509 when using bigInt.randBetween("16777216", "33554431");