/** * @since 1.0.0 */ import type * as Chunk from "@effect/data/Chunk" import type * as Effect from "@effect/io/Effect" import * as defaultServices from "@effect/io/internal/defaultServices" import * as internal from "@effect/io/internal/random" /** * @since 1.0.0 * @category symbols */ export const RandomTypeId: unique symbol = internal.RandomTypeId /** * @since 1.0.0 * @category symbols */ export type RandomTypeId = typeof RandomTypeId /** * @since 1.0.0 * @category models */ export interface Random { readonly [RandomTypeId]: RandomTypeId /** * Returns the next numeric value from the pseudo-random number generator. */ next(): Effect.Effect /** * Returns the next boolean value from the pseudo-random number generator. */ nextBoolean(): Effect.Effect /** * Returns the next integer value from the pseudo-random number generator. */ nextInt(): Effect.Effect /** * Returns the next numeric value in the specified range from the * pseudo-random number generator. */ nextRange(min: number, max: number): Effect.Effect /** * Returns the next integer value in the specified range from the * pseudo-random number generator. */ nextIntBetween(min: number, max: number): Effect.Effect /** * Uses the pseudo-random number generator to shuffle the specified iterable. */ shuffle(elements: Iterable): Effect.Effect> } /** * Returns the next numeric value from the pseudo-random number generator. * * @since 1.0.0 * @category constructors */ export const next: Effect.Effect = defaultServices.next /** * Returns the next integer value from the pseudo-random number generator. * * @since 1.0.0 * @category constructors */ export const nextInt: Effect.Effect = defaultServices.nextInt /** * Returns the next boolean value from the pseudo-random number generator. * * @since 1.0.0 * @category constructors */ export const nextBoolean: Effect.Effect = defaultServices.nextBoolean /** * Returns the next numeric value in the specified range from the * pseudo-random number generator. * * @since 1.0.0 * @category constructors */ export const nextRange: (min: number, max: number) => Effect.Effect = defaultServices.nextRange /** * Returns the next integer value in the specified range from the * pseudo-random number generator. * * @since 1.0.0 * @category constructors */ export const nextIntBetween: (min: number, max: number) => Effect.Effect = defaultServices.nextIntBetween /** * Uses the pseudo-random number generator to shuffle the specified iterable. * * @since 1.0.0 * @category constructors */ export const shuffle: (elements: Iterable) => Effect.Effect> = defaultServices.shuffle /** * Retreives the `Random` service from the context and uses it to run the * specified workflow. * * @since 1.0.0 * @category constructors */ export const randomWith: (f: (random: Random) => Effect.Effect) => Effect.Effect = defaultServices.randomWith