Need to use compareTo when comparing BigIntegers, otherwise get a string comparison with lexical order
This commit is contained in:
parent
168b184a1a
commit
0ce32bec92
|
@ -124,7 +124,7 @@ module.exports = {
|
|||
|
||||
var range = max.subtract(min);
|
||||
var r = this.getRandomBigInteger(range.bitLength());
|
||||
while (r > range) {
|
||||
while (r.compareTo(range) > 0) {
|
||||
r = this.getRandomBigInteger(range.bitLength());
|
||||
}
|
||||
return min.add(r);
|
||||
|
|
Loading…
Reference in New Issue
Block a user