TRandom overview
Added in v2.0.0
Table of contents
context
Tag
The service tag used to access TRandom
in the environment of an effect.
Signature
export declare const Tag: Context.Tag<TRandom, TRandom>
Added in v2.0.0
live
The “live” TRandom
service wrapped into a Layer
.
Signature
export declare const live: Layer.Layer<TRandom, never, never>
Added in v2.0.0
models
TRandom (interface)
Signature
export interface TRandom {
readonly [TRandomTypeId]: TRandomTypeId
/**
* Returns the next numeric value from the pseudo-random number generator.
*/
readonly next: STM.STM<number>
/**
* Returns the next boolean value from the pseudo-random number generator.
*/
readonly nextBoolean: STM.STM<boolean>
/**
* Returns the next integer value from the pseudo-random number generator.
*/
readonly nextInt: STM.STM<number>
/**
* Returns the next numeric value in the specified range from the
* pseudo-random number generator.
*/
nextRange(min: number, max: number): STM.STM<number>
/**
* Returns the next integer value in the specified range from the
* pseudo-random number generator.
*/
nextIntBetween(min: number, max: number): STM.STM<number>
/**
* Uses the pseudo-random number generator to shuffle the specified iterable.
*/
shuffle<A>(elements: Iterable<A>): STM.STM<Array<A>>
}
Added in v2.0.0
random
next
Returns the next number from the pseudo-random number generator.
Signature
export declare const next: STM.STM<number, never, TRandom>
Added in v2.0.0
nextBoolean
Returns the next boolean value from the pseudo-random number generator.
Signature
export declare const nextBoolean: STM.STM<boolean, never, TRandom>
Added in v2.0.0
nextInt
Returns the next integer from the pseudo-random number generator.
Signature
export declare const nextInt: STM.STM<number, never, TRandom>
Added in v2.0.0
nextIntBetween
Returns the next integer in the specified range from the pseudo-random number generator.
Signature
export declare const nextIntBetween: (low: number, high: number) => STM.STM<number, never, TRandom>
Added in v2.0.0
nextRange
Returns the next number in the specified range from the pseudo-random number generator.
Signature
export declare const nextRange: (min: number, max: number) => STM.STM<number, never, TRandom>
Added in v2.0.0
shuffle
Uses the pseudo-random number generator to shuffle the specified iterable.
Signature
export declare const shuffle: <A>(elements: Iterable<A>) => STM.STM<Array<A>, never, TRandom>
Added in v2.0.0
symbols
TRandomTypeId
Signature
export declare const TRandomTypeId: typeof TRandomTypeId
Added in v2.0.0
TRandomTypeId (type alias)
Signature
export type TRandomTypeId = typeof TRandomTypeId
Added in v2.0.0