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

@ts-utilkit/random

v0.1.1

Published

Random generation utilities for numbers, strings, arrays, and weighted selections

Readme

@ts-utilkit/random

random Functions - TypeScript utility functions for random operations.

Installation

npm install @ts-utilkit/random

Features

  • 🚀 TypeScript-first with complete type definitions
  • ✅ Comprehensive test coverage (>95%)
  • 📦 Tree-shakeable ESM and CommonJS support
  • 🔒 Type-safe with strict TypeScript configuration
  • 📖 Extensive JSDoc documentation

Available Functions (25)

  • randomInt - Generates a random integer within a range
  • randomFloat - Generates a random floating-point number within a range
  • randomBoolean - Generates a random boolean value
  • randomElement - Selects a random element from an array
  • randomElements - Selects multiple random elements from an array
  • randomString - Generates a random string of specified length
  • randomHex - Generates a random hexadecimal string
  • randomUUID - Generates a random UUID (v4)
  • randomColor - Generates a random color in hex format
  • randomRGB - Generates a random RGB color object
  • randomDate - Generates a random date within a range
  • randomChoice - Makes a random choice based on weighted probabilities
  • shuffleArray - Randomly shuffles an array (Fisher-Yates algorithm)
  • randomSample - Takes a random sample of specified size from an array
  • randomPassword - Generates a random password with configurable options
  • randomAlphanumeric - Generates a random alphanumeric string
  • randomDigits - Generates a random string of digits
  • randomLetters - Generates a random string of letters
  • randomBytes - Generates cryptographically secure random bytes
  • randomIntCrypto - Generates a cryptographically secure random integer
  • randomFloatCrypto - Generates a cryptographically secure random float
  • randomIP - Generates a random IP address (IPv4 or IPv6)
  • randomMACAddress - Generates a random MAC address
  • randomPhoneNumber - Generates a random phone number
  • randomEmail - Generates a random email address

Usage Examples

import { randomInt, randomElement, randomPassword, shuffleArray } from '@ts-utilkit/random';

// Random integer
const dice = randomInt(1, 6);
// Result: Random number between 1 and 6

// Random element from array
const fruits = ['apple', 'banana', 'orange'];
const randomFruit = randomElement(fruits);
// Result: One random fruit

// Secure password generation
const password = randomPassword(16, { uppercase: true, numbers: true, symbols: true });
// Result: "aB7#kL9$pQ2@mN5!"

// Shuffle array
const cards = [1, 2, 3, 4, 5];
const shuffled = shuffleArray(cards);
// Result: [3, 1, 5, 2, 4] (random order)

API Documentation

For complete API documentation, please visit the main repository.

License

MIT © MForofontov

Contributing

Contributions are welcome! Please see the main repository for contribution guidelines.