A universally-unique, lexicographically-sortable, identifier generator
78
Build a deterministic ULID generation system that produces repeatable identifiers for testing and development environments. The system should allow seeding a pseudo-random number generator to create predictable, reproducible ULID sequences while maintaining the ULID format and properties.
Create a seeded pseudo-random number generator that accepts a numeric seed and produces consistent random values. The generator should return values between 0 and 1, suitable for use with the identifier generation library.
Implement a function that generates identifiers using a custom seeded random number generator. The function should:
Create a function that generates a sequence of identifiers using a seeded generator. The function should:
All identifiers must be valid and conform to the expected 26-character format.
@generates
/**
* Creates a seeded pseudo-random number generator
* @param seed - Numeric seed value
* @returns A function that returns numbers between 0 and 1
*/
export function createSeededPRNG(seed: number): () => number;
/**
* Generates a deterministic identifier using a seeded PRNG
* @param seed - Numeric seed value
* @param timestamp - Optional timestamp in milliseconds
* @returns A 26-character identifier string
*/
export function generateDeterministicULID(seed: number, timestamp?: number): string;
/**
* Generates a sequence of deterministic identifiers
* @param seed - Numeric seed value
* @param count - Number of identifiers to generate
* @returns Array of identifier strings
*/
export function generateSequence(seed: number, count: number): string[];Provides unique identifier generation support with custom PRNG capability.
Install with Tessl CLI
npx tessl i tessl/npm-ulidevals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10