effect-io-ai

Package: effect
Module: Random

Random.nextInt

Generates a random integer between Number.MIN_SAFE_INTEGER (inclusive) and Number.MAX_SAFE_INTEGER (inclusive).

When to use

Use to generate a pseudo-random safe integer across the full safe-integer range.

Example (Generating a random integer)

import { Effect, Random } from "effect"

const program = Effect.gen(function*() {
  const randomInt = yield* Random.nextInt
  console.log("Random integer:", randomInt)
})

Signature

declare const nextInt: Effect.Effect<number, never, never>

Source

Since v2.0.0