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-7/

Fair Seat Rotator

Randomly rotates seat numbers for recurring sessions while ensuring every seat is chosen exactly once per round before any repeat.

Capabilities

Full-round coverage

  • Calling the allocator across a full round for seats 1 through 8 returns each seat exactly once before any seat reappears. @test
  • The first pick of the second round differs from the last pick of the first round while still completing another full permutation. @test

Shared stream

  • Mixing direct calls with for...of iteration consumes the same underlying stream, so values are not repeated or skipped when switching between the two access patterns. @test

Single-seat fallback

  • When the allocator is created with identical minimum and maximum seat numbers, every call and iteration yields that single seat. @test

Implementation

@generates

API

export function createSeatAllocator(minSeat: number, maxSeat: number): (() => number) & {
  [Symbol.iterator](): Iterator<number>;
};

Dependencies { .dependencies }

unique-random { .dependency }

Provides repeat-free random rotation across a bounded integer range before cycling.

@satisfied-by

Install with Tessl CLI

npx tessl i tessl/npm-unique-random

tile.json