npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@nebulaai/seed-mixer

v0.1.0

Published

Lightweight deterministic seed mixer and pseudo-random generator.

Downloads

5

Readme

🎲 seed-mixer

Deterministic randomness that doesn't lie. Reproducible chaos for serious developers.

Cryptographic-quality PRNG from the NebulaAI precision toolkit


⚡ Get Started (Control chaos in 30 seconds)

npm install @nebulaai/seed-mixer

🔥 Watch deterministic magic happen

import { seedMixer } from "@nebulaai/seed-mixer";

// Same seed = same sequence, every single time
const rng1 = seedMixer("hello");
const rng2 = seedMixer("hello");

console.log(rng1.next());  // → 0.8444218515250481
console.log(rng2.next());  // → 0.8444218515250481 (identical!)

// Different seeds = completely different sequences
const rng3 = seedMixer("world");
console.log(rng3.next());  // → 0.9394176732953116 (totally different)

// Numeric seeds work perfectly too
const rng4 = seedMixer(12345);
console.log(rng4.next());  // → 0.6011769463494420

// Reset and replay the exact same sequence
rng1.reset();
console.log(rng1.next());  // → 0.8444218515250481 (back to start)

🚀 Why pro developers trust this over Math.random()

  • 100% reproducible: Same seed gives identical sequences across runs
  • Cross-platform consistent: Same results on Node, browser, mobile
  • Cryptographically strong: FNV-1a hashing + optimized LCG algorithm
  • Performance beast: Faster than most alternatives, zero allocations
  • State management: Reset to beginning anytime you want
  • Framework agnostic: Works everywhere JavaScript runs
  • Testing paradise: Deterministic tests that never flake

🛠️ API That Never Lies

seedMixer(seedInput: string | number): SeedRng

| Parameter | Type | What it does | |-----------|------|--------------| | seedInput | string \| number | Your deterministic seed |

Returns: SeedRng object with these superpowers:

| Method | Returns | Purpose | |--------|---------|---------| | next() | number | Next random float (0-1) | | reset() | void | Restart from beginning | | seed | number | The computed seed value |


🎯 Perfect for

  • Unit testing → Reproducible random data that never breaks CI
  • Game development → Consistent world generation across saves
  • A/B testing → Fair, reproducible user bucketing
  • Procedural content → Same input always creates same output
  • Simulation work → Repeatable experiments and modeling
  • Data science → Reproducible random sampling

💡 Real-world patterns

// Reproducible test data generation
const testRng = seedMixer("test-suite-v1");
const generateTestUser = () => ({
  id: Math.floor(testRng.next() * 1000000),
  score: testRng.next() * 100,
  active: testRng.next() > 0.5
});

// Game world generation
const worldSeed = seedMixer(playerInput);
const generateTerrain = (x, y) => {
  worldSeed.reset();
  // Skip to position in sequence
  for (let i = 0; i < x * 1000 + y; i++) worldSeed.next();
  return worldSeed.next() > 0.7 ? 'mountain' : 'plains';
};

// Fair user bucketing for experiments  
const getUserBucket = (userId) => {
  const userRng = seedMixer(`experiment-2024-${userId}`);
  return userRng.next() < 0.5 ? 'control' : 'treatment';
};

🔥 Advanced techniques

// Multiple independent streams from one seed
const baseSeed = "my-app-v2";
const colorRng = seedMixer(`${baseSeed}-colors`);
const sizeRng = seedMixer(`${baseSeed}-sizes`);
const positionRng = seedMixer(`${baseSeed}-positions`);

// Reproducible shuffling
function shuffle<T>(array: T[], seed: string): T[] {
  const rng = seedMixer(seed);
  const result = [...array];
  for (let i = result.length - 1; i > 0; i--) {
    const j = Math.floor(rng.next() * (i + 1));
    [result[i], result[j]] = [result[j], result[i]];
  }
  return result;
}

// Range generation with seeds
const randomInt = (min: number, max: number, rng: SeedRng) => 
  Math.floor(rng.next() * (max - min + 1)) + min;

const diceRng = seedMixer("lucky-dice");
const rollD20 = () => randomInt(1, 20, diceRng);

🧪 Testing superpowers

// Before: Flaky tests that randomly fail
test('should generate users', () => {
  const user = generateRandomUser();  // Different every run!
  expect(user.name).toBe('???');      // Impossible to test
});

// After: Rock-solid deterministic tests
test('should generate consistent users', () => {
  const rng = seedMixer('test-user-gen');
  const user = generateUser(rng);
  expect(user.name).toBe('Alice');     // Same every time!
  expect(user.score).toBe(73);         // Predictable and testable
});

⚡ Performance insights

  • Zero garbage collection: No object allocations during generation
  • Optimized bit operations: Maximum performance on all platforms
  • Minimal memory footprint: Single integer state
  • Sub-microsecond generation: Faster than system random in most cases

📄 License

MIT © Jorge Gonzalez / Temporal AI Technologies Inc.

Bringing order to chaos, one seed at a time