veffect
Version:
powerful TypeScript validation library built on the robust foundation of Effect combining exceptional type safety, high performance, and developer experience. Taking inspiration from Effect's functional principles, VEffect delivers a balanced approach tha
107 lines • 3.09 kB
TypeScript
/**
* @since 2.0.0
*/
import type * as Chunk from "./Chunk.js";
import type * as Context from "./Context.js";
import type * as Effect from "./Effect.js";
/**
* @since 2.0.0
* @category symbols
*/
export declare const RandomTypeId: unique symbol;
/**
* @since 2.0.0
* @category symbols
*/
export type RandomTypeId = typeof RandomTypeId;
/**
* @since 2.0.0
* @category models
*/
export interface Random {
readonly [RandomTypeId]: RandomTypeId;
/**
* Returns the next numeric value from the pseudo-random number generator.
*/
readonly next: Effect.Effect<number>;
/**
* Returns the next boolean value from the pseudo-random number generator.
*/
readonly nextBoolean: Effect.Effect<boolean>;
/**
* Returns the next integer value from the pseudo-random number generator.
*/
readonly nextInt: Effect.Effect<number>;
/**
* Returns the next numeric value in the specified range from the
* pseudo-random number generator.
*/
nextRange(min: number, max: number): Effect.Effect<number>;
/**
* Returns the next integer value in the specified range from the
* pseudo-random number generator.
*/
nextIntBetween(min: number, max: number): Effect.Effect<number>;
/**
* Uses the pseudo-random number generator to shuffle the specified iterable.
*/
shuffle<A>(elements: Iterable<A>): Effect.Effect<Chunk.Chunk<A>>;
}
/**
* Returns the next numeric value from the pseudo-random number generator.
*
* @since 2.0.0
* @category constructors
*/
export declare const next: Effect.Effect<number>;
/**
* Returns the next integer value from the pseudo-random number generator.
*
* @since 2.0.0
* @category constructors
*/
export declare const nextInt: Effect.Effect<number>;
/**
* Returns the next boolean value from the pseudo-random number generator.
*
* @since 2.0.0
* @category constructors
*/
export declare const nextBoolean: Effect.Effect<boolean>;
/**
* Returns the next numeric value in the specified range from the
* pseudo-random number generator.
*
* @since 2.0.0
* @category constructors
*/
export declare const nextRange: (min: number, max: number) => Effect.Effect<number>;
/**
* Returns the next integer value in the specified range from the
* pseudo-random number generator.
*
* @since 2.0.0
* @category constructors
*/
export declare const nextIntBetween: (min: number, max: number) => Effect.Effect<number>;
/**
* Uses the pseudo-random number generator to shuffle the specified iterable.
*
* @since 2.0.0
* @category constructors
*/
export declare const shuffle: <A>(elements: Iterable<A>) => Effect.Effect<Chunk.Chunk<A>>;
/**
* Retreives the `Random` service from the context and uses it to run the
* specified workflow.
*
* @since 2.0.0
* @category constructors
*/
export declare const randomWith: <A, E, R>(f: (random: Random) => Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>;
/**
* @since 2.0.0
* @category context
*/
export declare const Random: Context.Tag<Random, Random>;
//# sourceMappingURL=Random.d.ts.map