fix(core): round value in randomBigIntInRange
This commit is contained in:
parent
82ab154f0f
commit
28b2efbb08
1 changed files with 1 additions and 1 deletions
|
@ -117,7 +117,7 @@ export function randomBigIntInRange(crypto: ICryptoProvider, max: bigint, min =
|
|||
const interval = max - min
|
||||
if (interval < 0n) throw new Error('expected min < max')
|
||||
|
||||
const byteSize = bigIntBitLength(interval) / 8
|
||||
const byteSize = Math.ceil(bigIntBitLength(interval) / 8)
|
||||
|
||||
let result = randomBigInt(crypto, byteSize)
|
||||
while (result > interval) result -= interval
|
||||
|
|
Loading…
Reference in a new issue