Generate a random float between min (inclusive) and max (exclusive). If max is omitted, generates a random float between 0-min.
min
max
0-min
the minimum value
Optional
the maximum value (exclusive)
a random float between min and max
import { randomFloat } from "@trashpanda001/helpers/number"randomFloat(100)// 59.9056391729085 .... [0, 100)randomFloat(5, 10)// 7.4373648706011615 .. [5, 10) Copy
import { randomFloat } from "@trashpanda001/helpers/number"randomFloat(100)// 59.9056391729085 .... [0, 100)randomFloat(5, 10)// 7.4373648706011615 .. [5, 10)
Generate a random float between
min
(inclusive) andmax
(exclusive). Ifmax
is omitted, generates a random float between0-min
.