diff --git a/src/modules/number/index.ts b/src/modules/number/index.ts index 9216df7a583..87464212a0a 100644 --- a/src/modules/number/index.ts +++ b/src/modules/number/index.ts @@ -90,11 +90,13 @@ export class NumberModule { /** * Returns a single random floating-point number for a given precision or range and precision. + * The lower bound is inclusive, the upper bound is exclusive, unless precision is passed. * * @param options Upper bound or options object. Defaults to `{}`. * @param options.min Lower bound for generated number. Defaults to `0.0`. * @param options.max Upper bound for generated number. Defaults to `1.0`. * @param options.precision Precision of the generated number, for example `0.01` will round to 2 decimal points. + * If precision is passed, the upper bound is inclusive. * * @example * faker.number.float() // 0.5688541042618454 @@ -165,6 +167,7 @@ export class NumberModule { /** * Returns a [binary](https://en.wikipedia.org/wiki/Binary_number) number. + * The bounds are inclusive. * * @param options Maximum value or options object. Defaults to `{}`. * @param options.min Lower bound for generated number. Defaults to `0`. @@ -213,6 +216,7 @@ export class NumberModule { /** * Returns an [octal](https://en.wikipedia.org/wiki/Octal) number. + * The bounds are inclusive. * * @param options Maximum value or options object. Defaults to `{}`. * @param options.min Lower bound for generated number. Defaults to `0`. @@ -261,11 +265,14 @@ export class NumberModule { /** * Returns a lowercase [hexadecimal](https://en.wikipedia.org/wiki/Hexadecimal) number. + * The bounds are inclusive. * * @param options Maximum value or options object. Defaults to `{}`. * @param options.min Lower bound for generated number. Defaults to `0`. * @param options.max Upper bound for generated number. Defaults to `15`. * + * @throws When options define `max < min`. + * * @example * faker.number.hex() // 'b' * faker.number.hex(255) // '9d' @@ -305,6 +312,7 @@ export class NumberModule { /** * Returns a [BigInt](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#bigint_type) number. + * The bounds are inclusive. * * @param options Maximum value or options object. Defaults to `{}`. * @param options.min Lower bound for generated bigint. Defaults to `0n`.