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

randomcryp

v2.2.0

Published

A cryptographically secure, feature rich, zero dependency and browser friendly random number generator library.

Readme

randomcryp

A cryptographically secure, feature rich, zero dependency, lightweight and browser friendly random number generator library. Only ~5KB in size. Uses Crypto.getRandomValues() to get its randomness. The spelling is random-creep in case you are wondering.

Featues

  • Lightweight
  • Browser friendly
  • TypeScript definitions
  • Lots of methods and common aliases
  • Batteries Included (Zero dependencies)
  • Supported in all major JavaScript / TypeScript runtimes (Browser, Node, Deno, Bun etc.)

Install

bun add randomcryp # bun
yarn add randomcryp # yarn
pnpm add randomcryp # pnpm
npm install randomcryp # npm

Usage

import random from "randomcryp";

float(); // 0.190088246732104

Or,

import { rangeInt } from "randomcryp";

rangeInt(1, 10); // 7

List of Methods

| Method | Description | Aliases | | -- | -- | -- | | bool(): boolean | Generates a random boolean (true or false). | bool()true | | boolean(): boolean | Alias for bool(). | boolean()false | | percentage(p: number): boolean | Generates true at given percentage of time. | percentage(20)false | | probability(p: number): boolean | Generates true with a given probability p and false with probability 1-p. | probability(0.8)true | | uSafeInt(): number | Generates a random integer between 0 (inclusive) and Number.MAX_SAFE_INTEGER (inclusive). | uSafeInt()4946544243668033 | | float(): number | Generates a random number between 0 (inclusive) and 1 (exclusive). | number()0.190088246732104 | | random(): number | Alias for float(). | random()0.9520779718919631 | | hex(length: number = 8, prefix: boolean = false): string | Generates a random hex string of the specified length (default 8). Optionally prefixes with '0x'. | hex(16)d1ef0149c7849844 | | choice(arr: ArrayLike<E>): E | Selects a random element from an array. | choice([1, 2, 3, 4, 5])3 | | pick(arr: ArrayLike<E>): E | Alias for choice(). | pick([1, 2, 3, 4, 5])1 | | shuffle(input: string): string, shuffle(input: Array<E>): Array<E> | Returns a new array or string after shuffling the given array or string randomly. | shuffle([1, 2, 3, 4, 5])[ 1, 3, 2, 5, 4 ] | | range(min: number, max: number): number | Generates a random number (not integer) between given min (inclusive) and max (exclusive). Throws if min > max. | range(1, 5)4.103370176158448 | | rangeInt(min: number, max: number): number | Generates a random number (not integer) between given min (inclusive) and max (exclusive). Throws if min > max. | rangeInt(1, 10)8 | | randInt(min: number, max: number): number | Alias for rangeInt(). | randInt(1, 100)35 | | safeInt(): number | Generates a random integer between Number.MIN_SAFE_INTEGER (inclusive) and Number.MAX_SAFE_INTEGER (inclusive). +0 and -0 both can be generated. 54 bits precision. Not recommended for general usage. | safeInt()-5802548511349229 | | ifloat(): number | Generates a random number between -1 (inclusive) and 1 (inclusive). Uses safeInt() and thus not recommended. | ifloat()-0.6076475248861822 |

© 2025, Md. Touhidur Rahman. License: BSD-3-Clause.