(min: number, max: number, options?: {
readonly halfOpen?: boolean
})
| 175 | * @since 2.0.0 |
| 176 | */ |
| 177 | export const nextIntBetween = (min: number, max: number, options?: { |
| 178 | readonly halfOpen?: boolean |
| 179 | }): Effect.Effect<number> => { |
| 180 | const extra = options?.halfOpen === true ? 0 : 1 |
| 181 | return randomWith((r) => { |
| 182 | const minInt = Math.ceil(min) |
| 183 | const maxInt = Math.floor(max) |
| 184 | return Math.floor(r.nextDoubleUnsafe() * (maxInt - minInt + extra)) + minInt |
| 185 | }) |
| 186 | } |
| 187 | |
| 188 | /** |
| 189 | * Uses the pseudo-random number generator to shuffle the specified iterable. |
nothing calls this directly
no test coverage detected