File size: 413 Bytes
96af7c9 |
1 2 3 4 5 6 7 8 9 10 11 |
import { BigInt } from '../utils/globals.js';
import { BigIntArbitrary } from './_internals/BigIntArbitrary.js';
export function bigIntN(n) {
if (n < 1) {
throw new Error('fc.bigIntN expects requested number of bits to be superior or equal to 1');
}
const min = BigInt(-1) << BigInt(n - 1);
const max = (BigInt(1) << BigInt(n - 1)) - BigInt(1);
return new BigIntArbitrary(min, max);
}
|