Skip to content

Commit

Permalink
fix(random): Correct JSDoc (#81)
Browse files Browse the repository at this point in the history
  • Loading branch information
mass2527 authored Jun 21, 2024
1 parent 92c9db0 commit 1b3d9be
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/math/random.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
/**
* Generates a random floating-point number between minimum (inclusive) and maximum (exclusive).
* If min is greater than maximum, the values are swapped.
* Generate a random number within the given range.
*
* @param {number} minimum - The lower bound (inclusive).
* @param {number} maximum - The upper bound (exclusive).
* @returns {number} A random integer between minimum (inclusive) and maximum (exclusive).
* @returns {number} A random number between minimum (inclusive) and maximum (exclusive). The number can be an integer or a decimal.
* @throws {Error} Throws an error if `maximum` is not greater than `minimum`.
*
* @example
* const result = random(0, 5); // result will be a random floating-point number between 0 (inclusive) and 5 (exclusive)
* const result2 = random(5, 0); // This will throw an error
* const result1 = random(0, 5); // Returns a random number between 0 and 5.
* const result2 = random(5, 0); // If the minimum is greater than the maximum, an error is thrown
* const result3 = random(5, 5); // If the minimum is equal to the maximum, an error is thrown.
*/
export function random(minimum: number, maximum: number): number {
if (minimum >= maximum) {
Expand Down

0 comments on commit 1b3d9be

Please sign in to comment.