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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@nap5/gnrng-id-wasm

v0.1.4

Published

WebAssembly bindings for GNRNG (Good Night Random Number Generator) - Core Rust implementation

Readme

@nap5/gnrng-id-wasm

npm version License: MIT

WebAssembly bindings for GNRNG (Good Night Random Number Generator) - Core Rust implementation.

This package contains the low-level WebAssembly bindings generated from Rust code. For a more user-friendly TypeScript API, see @nap5/gnrng-id.

✨ Features

  • 🦀 Pure Rust Implementation: High-performance GNRNG algorithm written in Rust
  • WebAssembly: Compiled to WASM for optimal performance in JavaScript environments
  • 🔒 Deterministic: Seed-based reproducible random number generation
  • 🚀 Batch Operations: Efficient bulk operations to minimize FFI overhead
  • 🌐 Universal: Works in Node.js, Deno, and browsers
  • 📦 Lightweight: Optimized WASM binary with minimal overhead

🚀 Installation

npm

npm install @nap5/gnrng-id-wasm

JSR (for Deno)

deno add npm:@nap5/gnrng-id-wasm

📖 Usage

Note: This package provides low-level WASM bindings. For a more convenient TypeScript API, use @nap5/gnrng-id instead.

Basic Usage

import init, { Gnrng } from '@nap5/gnrng-id-wasm'

// Initialize WASM module
await init()

// Create GNRNG instance
const rng = new Gnrng('my-seed')

// Generate random numbers
const value = rng.next()           // 0.0 ~ 1.0
const intValue = rng.nextRange(1, 100)  // 1 ~ 99

// Batch operations (high performance)
const batch = rng.nextBatch(1000)
const rangeBatch = rng.nextRangeBatch(1, 10, 500)

// Clean up
rng.free()

Browser Usage

<script type="module">
  import init, { Gnrng } from 'https://unpkg.com/@nap5/gnrng-id-wasm/pkg/gnrng_id_wasm.js'
  
  async function example() {
    await init()
    const rng = new Gnrng('browser-seed')
    console.log(rng.next())
    rng.free()
  }
  
  example()
</script>

🏗️ API Reference

Gnrng

WebAssembly class for deterministic random number generation.

Constructor

  • new Gnrng(seed: string): Create a new GNRNG instance with the given seed

Methods

  • next(): number: Generate next random float [0.0, 1.0)
  • nextRange(min: number, max: number): number: Generate random integer [min, max)
  • nextBatch(count: number): Float64Array: Generate batch of random floats
  • nextRangeBatch(min: number, max: number, count: number): Int32Array: Generate batch of random integers
  • free(): void: Release WASM memory (important!)

Functions

  • init(): Promise<void>: Initialize the WASM module

🔧 Building from Source

Prerequisites

  • Rust 1.86.0+
  • wasm-pack

Build Commands

# Development build
npm run build:dev

# Production build  
npm run build

# Run tests
npm test

# Check code
npm run check
npm run clippy
npm run fmt

🌟 Related Packages

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

🤝 Contributing

Contributions are welcome! Please see our Contributing Guide for details.


Made with ❤️ by Higashi Kota