Skip to content

samplePair(random, lowerBound, upperExclusive): readonly [number, number]

Defined in: packages/sampling/src/sample-pair.ts:23

Sample an ascending pair of distinct integers in [lowerBound, upperExclusive).

Runs in O(1) time and auxiliary space and does not mutate its inputs.

RandomSource

number

number

readonly [number, number]

With code INVALID_RANGE when the bounds are not safe integers spanning between 2 and 2^32 values.

With code INVALID_SOURCE_VALUE when the random source returns a value outside [0, 1).