Skip to content

randomFloat() ​

randomFloat(min, max): number

Defined in: utils/math/randomFloat.ts:13

Generates a random floating-point number between min and max.

Parameters ​

min ​

number

The minimum value.

max ​

number

The maximum value.

Returns ​

number

A random float between min and max. Returns NaN if inputs are invalid.

Example ​

tsx
const random = randomFloat(1.5, 5.5); // e.g., 3.14

Released under the MIT License.