Core · function

pickBySeed

Deterministically choose one item from a list.

Explained in The loop.

function pickBySeed<T>(seed: number, items: readonly T[]): T | null
import { pickBySeed } from '@driftengine/core';

Parameters

ParameterTypeDescription
seednumber
itemsreadonly T[]

In depth

The seed is hashed before the modulo rather than used raw. seed % length walks the list in order, so consecutive seeds — day numbers, level indices — produce a visible cycle; multiplying by the golden-ratio constant first scatters them, which is the difference between "today's track" feeling picked and feeling like a rota.