CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-unique-random

Generate random numbers that are consecutively unique

90

1.13x
Overview
Eval results
Files

task.mdevals/scenario-4/

Constant Bound Stream

A callable-and-iterable numeric source built around inclusive bounds, emphasizing the equal-bounds case.

Capabilities

Constant output for equal bounds

  • Directly invoking the source five times when minimum and maximum match returns that bound value each time without throwing. @test
  • Iterating over the first five values with for...of when minimum and maximum match yields the same bound value on every step. @test

Shared call and iteration state

  • Interleave two direct calls with three iterator pulls after constructing the source with equal bounds; every read returns the bound value with no divergence between modes. @test

Implementation

@generates

API

export type NumberSource = (() => number) & { [Symbol.iterator](): Iterator<number> };

/**
 * Returns a callable + iterable numeric source emitting pseudo-random integers within inclusive bounds.
 * When minimum equals maximum, it must emit that exact value indefinitely through both direct calls and iteration.
 */
export function createBoundedSource(minimum: number, maximum: number): NumberSource;

Dependencies { .dependencies }

unique-random { .dependency }

Use this package to drive the numeric source behavior, including its handling of equal bounds.

Install with Tessl CLI

npx tessl i tessl/npm-unique-random

tile.json