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

uid-rn

v1.2.0

Published

a random number generator

Readme

--

generate-random-number

A simple and lightweight npm package for generating random integers within a specified range. Perfect for quick and efficient use in applications like games, simulations, or anywhere a random number is needed.


Installation

Using npm:

npm install uid-rn

Using yarn:

yarn add uid-rn

Usage

Import the Function

You can import the package into your project as follows:

import uidRn from "uid-rn";

Basic Example

Generate a random number using the default range (0 to 90):

const randomNumber = uidRn();
console.log(randomNumber); // Example output: 42

Parameters

The uidRn function takes two optional parameters:

  1. min (number):

    • The minimum value for the random number (inclusive).
    • Default value: 0.
  2. max (number):

    • The maximum value for the random number (exclusive).
    • Default value: 90.

Examples

Default Usage

When no parameters are passed, the function generates a random number between 0 (inclusive) and 90 (exclusive):

uidRn(); // Example output: 67

Custom Range

Specify a custom range by passing the min and max values:

// Random number between 10 and 50
const randomNumber = uidRn(10, 50);
console.log(randomNumber); // Example output: 23

Negative Range

You can use negative numbers as the min or max value:

// Random number between -20 and 20
const randomNumber = uidRn(-20, 20);
console.log(randomNumber); // Example output: -5

Large Ranges

Generate a random number within a larger range:

// Random number between 100 and 1000
const randomNumber = uidRn(100, 1000);
console.log(randomNumber); // Example output: 786

Why Use This Package?

  • Lightweight: No dependencies; focused on a single task.
  • Flexible: Allows you to customize the range easily.
  • TypeScript-Friendly: Includes built-in type definitions for seamless use in TypeScript projects.
  • Beginner-Friendly: Intuitive and straightforward API.

Installation for Development

Clone the repository to make changes or enhance the package:

git clone https://github.com/yourusername/uid-rn.git
cd uid-rn

Install dependencies (if required):

npm install

Contributing

Contributions are welcome! If you’d like to improve the package, follow these steps:

  1. Fork the repository.
  2. Create a new branch with your feature or bug fix.
  3. Commit your changes.
  4. Open a pull request.

License

This package is licensed under the MIT License.