Generate random numbers that are consecutively unique
90
Uniformly samples integers from a closed range without repeating the previous value, while keeping both bounds reachable over time. The sampler can be used as both a callable and an iterator that share the same internal state.
[1, 4] never yields the same integer twice in a row. @testfor...of continues from the same sequence rather than restarting. @test[1, 3], both 1 and 3 appear at least once. @testminimum === maximum, repeated calls always return that value. @test@generates
export type RangeSampler = (() => number) & {
[Symbol.iterator](): Iterator<number>;
};
export function createRangeSampler(minimum: number, maximum: number): RangeSampler;Random integer generator that supports consecutive-unique sampling with shared iteration behavior.
Install with Tessl CLI
npx tessl i tessl/npm-unique-random