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

@justanotherdot/hedgehog-splitmix-wasm

v0.4.0

Published

WebAssembly bindings for SplitMix64 PRNG

Readme

Hedgehog SplitMix64 WASM

High-performance WebAssembly implementation of the SplitMix64 splittable pseudorandom number generator.

Overview

This is a language-agnostic WebAssembly module that provides:

  • SplitMix64 algorithm: High-quality 64-bit pseudorandom number generation
  • Splittable streams: Create independent random number generators
  • Deterministic: Same seed always produces same sequence
  • High performance: ~6x faster than pure JavaScript implementations

Building

Requires wasm-pack:

# From project root
bin/build-wasm

# Or manually
cd hedgehog-splitmix-wasm
wasm-pack build --target web --out-dir pkg

Usage

From TypeScript/JavaScript

import { Seed } from './hedgehog-splitmix-wasm/pkg';

// Create seed from number
const seed = new Seed(42);

// Generate random values
const { value, seed: nextSeed } = seed.next_u64();
const { value: bounded, seed: nextSeed2 } = seed.next_bounded(100);
const { value: boolean, seed: nextSeed3 } = seed.next_bool();

// Split into independent streams
const { left, right } = seed.split();

From other languages

The WASM module can be imported and used from any language that supports WebAssembly:

  • Python (with wasmtime-py or similar)
  • Go (with wasmtime-go)
  • Rust (with wasmtime)
  • C/C++ (with WASI)
  • And many others

API

Seed

  • new Seed(value: u64) - Create seed from number
  • Seed.from_parts(state: u64, gamma: u64) - Create from components
  • seed.state - Get state component
  • seed.gamma - Get gamma component
  • seed.next_u64() - Generate next u64 and new seed
  • seed.next_bounded(bound: u64) - Generate bounded value [0, bound)
  • seed.next_bool() - Generate boolean
  • seed.split() - Split into two independent seeds

Algorithm Details

Based on the SplitMix64 algorithm with these key properties:

  • Period: 2^64 for each generator stream
  • Quality: Passes statistical randomness tests
  • Splitting: Creates mathematically independent streams
  • Performance: Optimized for speed and small WASM binary size

Constants

  • Golden ratio: 0x9e3779b97f4a7c15
  • Mix multipliers: 0xbf58476d1ce4e5b9, 0x94d049bb133111eb

License

BSD-3-Clause (same as parent project)