๐ฒ RandBox Full Feature Overview
RandBox is a powerful JavaScript random data generation library, offering over 100 data types across 10+ major categories to meet your diverse needs in development, testing, and data simulation!
Powerful Features
RandBox provides a rich API and flexible configuration options, supporting comprehensive random data generation from basic data types to complex business scenarios. Whether for unit testing, data population, or rapid prototyping, RandBox offers a reliable solution.
๐ฏ Usage Methods Module
RandBox supports multiple environments and usage methods, making integration into various projects easy:
- ๐ Browser Environment: Supports simple, intermediate, and advanced usage to meet different complexity needs.
- ๐ฆ Package Managers: Supports installation via mainstream package managers like Bower, npm, and yarn.
- ๐ง Module Loading: Compatible with various loading methods, including RequireJS and ES6 modules.
- ๐ฅ๏ธ Node.js Environment: Perfect support for server-side JavaScript development.
- โ๏ธ Custom Functionality: Supports custom random functions and a CLI command-line tool.
- ๐ฑ Seed System: Supports number, string, and multi-parameter seeds to ensure reproducible randomness.
๐จ Basic Data Types
Core random data generation features, covering all basic data types:
- ๐ข Numeric Types: Boolean, Integer, Floating-point, Natural Number, Prime Number
- ๐ค Character Types: Random Character, Letter, String, Template String
- ๐ Special Types: JavaScript Falsy values, Hexadecimal, Buffer
๐ฐ Financial Data Module
Professional financial data generation, compliant with real-world standards:
- ๐ณ Credit Card System: Luhn-compliant credit card numbers, CVV, expiration dates
- ๐ฆ Currency System: Random currency codes, currency pairs, USD/Euro amounts
- ๐ International Standards: Supports IBAN and various credit card type identification
๐ ๏ธ Helper Tools Module
Practical data manipulation and processing tools:
- ๐ฒ Array Operations: Random selection, shuffling, unique value generation
- ๐ง String Utilities: Capitalization, number padding, weighted selection
- โก Performance Optimization: Mixin functionality, dataset overriding, batch generation
๐ Geographical Location Module
Global geographical data generation, supporting multiple countries and regions:
- ๐ Address System: Street address, City, Country, Coordinates
- ๐ Communication Info: Phone numbers, Area codes (supports USA, UK, France)
- ๐บ๏ธ Geographical Data: Latitude, Longitude, Altitude, Depth, Geohash, Timezone
๐ฎ Miscellaneous Tools Module
A wealth of practical utilities and gamified features:
- ๐ฏ Random Selection: Coin toss, Dice system (d4 to d100)
- ๐ Identifier Generation: GUID, Hash value, Timestamp
- ๐ Statistical Features: Normal distribution, RPG dice system, Radio call signs
๐ฑ Mobile Device Module
Dedicated identifier generation for mobile platforms:
- ๐ค Android Platform: GCM Registration ID, Device Identifier
- ๐ iOS Platform: Apple Push Token, Device Identification
- ๐ฑ Other Platforms: BlackBerry PIN, Windows Phone ANID
๐ต Music Data Module
Professional music-related data generation:
- ๐ผ Note System: Random musical notes, flats, sharps, natural notes
- ๐ธ Music Genres: 22 main genres, over 600 subgenres
- โฑ๏ธ Tempo System: Random tempo (40-320 BPM range)
๐ค Personal Information Module
Comprehensive personal identity data generation, supporting multi-national standards:
- ๐ Basic Information: Name, Age, Birthday, Gender, Zodiac Sign
- ๐ Identity Documents: US SSN, Indian Aadhar, Italian CF, Brazilian CPF
- ๐ท๏ธ Title System: Name prefixes, suffixes, supporting multiple nationalities
๐ Text Generation Module
Intelligent text content generation:
- ๐ Document Structure: Paragraphs, Sentences, Words, Syllables
- ๐ Emojis: Supports categorization and length control
- ๐ฃ๏ธ Phonetic Features: Generation of semi-pronounceable nonsense words
๐พ Entities Module
Random generation of various entities:
- ๐ฆ Animal System: Supports categories like marine, desert, grassland, forest, farm, pet, zoo
โฐ Date and Time Module
A complete time data generation system:
- ๐ Date & Time: Random Date, Time, Timestamp, Timezone
- ๐ Time Components: Hour, Minute, Second, Millisecond, AM/PM indicator
- ๐ Date Components: Year, Month, Weekday, Weekday restriction
๐ Web Data Module
Comprehensive support for internet and network-related data:
- ๐ Network Identifiers: IP Address, IPv6, MAC Address, Domain Name
- ๐ง Communication Tools: Email, URL, Social Media Username
- ๐จ Visual Elements: Color generation (6 formats like hex, rgb, rgba)
- ๐ข Business Data: Company Name, Profession, Google Analytics Code
Quick Start
Install RandBox
# Using npm
npm install randbox
# Using yarn
yarn add randbox
# Using bower
bower install randbox
Basic Usage Example
import RandBox from 'randbox';
const randBox = new RandBox();
// Basic Data Types
console.log(randBox.bool()); // true/false
console.log(randBox.integer(1, 100)); // 42
console.log(randBox.string(10)); // "aBcD1234eF"
// Personal Information
console.log(randBox.name()); // "Sarah Johnson"
console.log(randBox.email()); // "john.doe@example.com"
console.log(randBox.age()); // 25
// Geographical Location
console.log(randBox.city()); // "New York"
console.log(randBox.country()); // "United States"
console.log(randBox.coordinates()); // "40.7128, -74.0060"
// Financial Data
console.log(randBox.cc()); // "4111111111111111"
console.log(randBox.currency()); // "USD"
Using a Seed for Reproducibility
import RandBox from 'randbox';
// Use the same seed to generate the same result
const randBox1 = new RandBox(12345);
const randBox2 = new RandBox(12345);
console.log(randBox1.name()); // "Alice Smith"
console.log(randBox2.name()); // "Alice Smith" (Same result)
Documentation and Support
- ๐ RandBox Full Documentationย
- ๐ฒ API Reference Manualย
- ๐ป GitHub Repositoryย
- ๐ Found an issue? Feel free to submit an Issueย
Development Roadmap
RandBox will continue to be updated and optimized, with plans to add more practical features:
- ๐ More Regional Support: Expand data formats for more countries and regions
- ๐ Performance Optimization: Continuously improve the efficiency of generation algorithms
- ๐ฆ Modular Enhancements: Provide finer-grained module separation
- ๐ง Custom Extensions: Support more flexible custom data types
If you find RandBox helpful, we welcome your support by clicking the โญ๏ธ Starย button on the top right of the project! Every star is the greatest encouragement for us, helping the project to continuously improve and move forward. Thank you very much for your support! ๐ฒ