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

random--generator

v1.0.3

Published

Dic&Random genetarors module with focus on name/password

Readme

Random--generator

A comprehensive JavaScript module for generating secure passwords, realistic names, and usernames for development and testing purposes.

Features

Secure Password Generation - Customizable length, character sets, and security options Realistic Name Generation - First names, last names, full names with gender options Business Name Generation - Professional company names by industry Username Generation - Multiple styles for different use cases Password Strength Validation - Built-in strength scoring system Zero Dependencies - Pure JavaScript, works in Node.js

Installation

From GitHub

npm install random--generator
note: make sure in your package.json you have --> "type": "module", 
 

Usage in Your Project

import RandomGenerator from './src/RandomGenerator.js'

const generator = new RandomGenerator()

Quick Start

import RandomGenerator from './src/RandomGenerator.js'

const generator = new RandomGenerator()

// Generate a secure password
const password = generator.generatePassword(12)
console.log(password) // "K9#mP2vX$nQ7"

// Generate a random name
const name = generator.generateName()
console.log(name) // "Sarah Johnson"

// Generate a username
const username = generator.generateUsername('modern')
console.log(username) // "cyber_dragon_42"

// Generate a business name
const business = generator.generateBusinessName('tech')
console.log(business) // "Digital Solutions"

API Reference

Password Generation

generatePassword(length, options)

Generates a secure password with customizable options.

Parameters:

  • length (number): Password length (default: 12)
  • options (object): Configuration options

Options:

{
  includeUppercase: true,    // Include A-Z
  includeLowercase: true,    // Include a-z
  includeNumbers: true,      // Include 0-9
  includeSymbols: true,      // Include !@#$%^&*
  excludeAmbiguous: false    // Exclude 0, O, 1, l, I
}

Examples:

// Basic secure password
generator.generatePassword(16)
// "K9#mP2vX$nQ7zR4w"

// Numbers only
generator.generatePassword(8, {
  includeUppercase: false,
  includeLowercase: false,
  includeSymbols: false
})
// "47382649"

// No symbols (letters and numbers only)
generator.generatePassword(12, {
  includeSymbols: false
})
// "Kf7nQ2mP9xL4"

// Letters only
generator.generatePassword(12, {
  includeNumbers: false,
  includeSymbols: false
})
// "QORUDbgDZzLm"

validatePasswordStrength(password)

Returns password strength score from 0-100.

generator.validatePasswordStrength("123456")        // 15 week
generator.validatePasswordStrength("Password123")   // 50  medium strength
generator.validatePasswordStrength("MyS3cur3P@ssw0rd!") // 100 strong 

Name Generation

generateName(type, gender)

Generates names based on type and gender preferences.

Parameters:

  • type (string): 'first', 'last', or 'full' (default: 'full')
  • gender (string): 'male', 'female', 'neutral', or 'any' (default: 'any')

Examples:

generator.generateName('first', 'male')     // "James"
generator.generateName('first', 'female')   // "Sarah"
generator.generateName('first', 'neutral')  // "Jordan"
generator.generateName('last')              // "Johnson"
generator.generateName()                    // "Emily Davis"

generateUsername(style)

Generates usernames in different styles.

Styles:

  • 'modern' - prefix_suffix_number format
  • 'simple' - word + number format
  • 'name_based' - firstname.lastname + number format

Examples:

generator.generateUsername('modern')     // "cyber_dragon_42"
generator.generateUsername('simple')     // "ninja847"
generator.generateUsername('name_based') // "emily.garcia23"

generateBusinessName(industry)

Generates professional business names.

Industries:

  • 'tech' - Technology companies
  • 'creative' - Creative/design studios
  • 'business' - General business/consulting
  • 'general' - Mixed industry terms (default)

Examples:

generator.generateBusinessName('tech')      // "CyberLogic Solutions"
generator.generateBusinessName('creative')  // "BrightPixel Studios"
generator.generateBusinessName()            // "PrimeStar Corp"

Real-World Use Cases

Web Development Testing

// Generate test users
const testUsers = Array(100).fill(0).map(() => ({
  name: generator.generateName(),
  username: generator.generateUsername('modern'),
  password: generator.generatePassword(12)
}))

Database Seeding

// Seed user database
const users = []
for (let i = 0; i < 1000; i++) {
  users.push({
    firstName: generator.generateName('first'),
    lastName: generator.generateName('last'),
    password: generator.generatePassword(16, { excludeAmbiguous: true })
  })
}

Password Suggestion Feature

// Generate password suggestions for users
const passwordSuggestions = [
  generator.generatePassword(12, { includeSymbols: false }),
  generator.generatePassword(16),
  generator.generatePassword(20, { excludeAmbiguous: true })
]

Performance

  • Password Generation: ~0.1ms per password
  • Name Generation: ~0.05ms per name
  • Memory Usage: <1MB for all data sets
  • No External Dependencies: Zero network requests

Security

Password Generation Security

  • Uses Math.random() for generation
  • For cryptographic security, consider integrating with crypto.randomBytes()
  • Passwords include full character diversity
  • Strength validation based on industry standards

Data Privacy

  • No data is stored or transmitted
  • All generation happens locally
  • No network dependencies

Development

Project Structure

random-generator-js/
├── src/
│   ├── RandomGenerator.js      # Main interface
│   ├── PasswordGenerator.js    # Password generation logic
│   ├── NameGenerator.js        # Name generation logic
│   └── data/
│       └── names.js           # Name databases
├── test-app/
│   └── test.js                # Test suite
├── README.md
├── testrapport.md             # Test documentation
└── package.json

Running Tests

Notice: Before running jest tests, make sure the Jest test code in test.js line 6 --> 27 and line 98 is uncommented. Then, run:

 run -> npm test (jest)
run -> node test-app/test.js ( to generate)

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests for new functionality
  5. Submit a pull request

License

MIT License - see LICENSE file for details.

Changelog

Version 1.0.0

  • Initial release
  • Password generation with full customization
  • Name generation (first, last, full names)
  • Username generation (multiple styles)
  • Business name generation
  • Password strength validation
  • Comprehensive test suite

Support

  • Issues: Report bugs and feature requests on GitHub
  • Documentation: This README covers all functionality
  • Examples: See test-app/test.js for usage examples

Why Choose This Module?

  • Focused Purpose: Designed specifically for development and testing
  • High Quality Output: Realistic, professional-looking generated data
  • Comprehensive Options: Extensive customization for all use cases
  • Zero Dependencies: Lightweight and reliable
  • Well Tested: 100% test coverage with manual verification
  • Developer Friendly: Clear API, good documentation, practical examples

Perfect for web developers, QA engineers, database administrators, and anyone who needs realistic test data.