Files
2026-05-27 23:29:53 +01:00

2.3 KiB

name: pseudo-random description: Use when implementing or debugging code that uses @suaveplan/pseudo-random: Deterministic seeded PRNG implementations (Mulberry32, SFC32, Xoshiro256++, CounterRng) with offset/fork/checkpoint/restore semantics.

@suaveplan/pseudo-random

Deterministic, seeded pseudo-random number generators (PRNGs) conforming to the Rng interface from @suaveplan/types. Ships four algorithms — Mulberry32, SFC32, Xoshiro256++, and CounterRng — with a unified SeededRng surface that includes nextUint32, nextFloat, skip, at, fork, checkpoint, and restore. Use this package when you need reproducible randomness (procedural generation, game simulations, property tests) or seek O(1) access to arbitrary positions in the sequence. For cryptographically secure randomness use @suaveplan/random (CSPRNG-backed) or @suaveplan/crypto (raw bytes). Utility functions shuffle, sample, choice, and weightedChoice accept any Rng and work with both seeded and crypto-backed sources.

When to use this skill

  • Implementing or debugging code that imports @suaveplan/pseudo-random.
  • The task touches: see package README.
  • You need API guidance for this package's exports.

Quick reference

import { /* see API Reference below */ } from "@suaveplan/pseudo-random";

Dependencies

Workspace dependencies: @suaveplan/error, @suaveplan/types

Where to read more

This skill is intentionally short. The package's own documentation is the authoritative source — read these in order:

  1. packages/foundation/pseudo-random/README.md — overview, install, quick-start, module index
  2. packages/foundation/pseudo-random/src/**/*.md — co-located docs per implementation file (Purpose, Features, Basic + Advanced examples, full API reference, Implementation notes — all packages ship ≥200 words per module)
  3. packages/foundation/pseudo-random/package.json exports map — every subpath you can import from

When the user asks an API question, read the relevant co-located .md first; do not answer from training-data memory.

See also

  • @suaveplan/error
  • @suaveplan/types

This SKILL.md is auto-generated by suaveplan-skills/scripts/generate-skills.ts from the package's README. Do not edit by hand — re-run the generator after the README changes.