random-ease
v1.0.8
Published
A powerful and versatile library for generating random data and values. It provides a wide range of functions to generate random numbers, strings, arrays, booleans, dates, colors, names, addresses, and more. The package is designed to simplify the generat
Downloads
279
Maintainers
Keywords
Readme
random-ease
A powerful and versatile library for generating random data and values. It provides a wide range of functions to generate random numbers, strings, arrays, booleans, dates, colors, names, addresses, and more. The package is designed to simplify the generation of random data for testing, prototyping, and data simulation purposes.
Installation
Install the package using npm:
npm install random-ease
Usage
Import the package and start generating random data with ease:
const randomEase = require('random-ease');
// Generates a random number within a specified range
console.log(randomEase.generateNumber(10, 10000));
// Generates a random string of a specified length using alphanumeric characters
console.log(randomEase.generateString(25));
// Generates an array of random numbers within a given range
console.log(randomEase.generateArray(5, 10, 15));
or in typescript
import randomEase from 'random-ease';
// or
// import { generateNumber } from 'random-ease';
// Generates a random boolean value
console.log(randomEase.generateBoolean());
Available Helper Functions
| Definition | Purpose | | --------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | | generateNumber(min: number, max: number): number | Generates a random number within a specified range | | generateString(length: number): string | Generates a random string of a specified length using alphanumeric characters | | generateArray(length: number, min: number, max: number): number[] | Generates an array of random numbers within a given range | | generateBoolean(): boolean | Generates a random boolean value | | generateFloat(min: number, max: number): number | Generates a random floating-point number within a given range | | generateRandomElement<T>(array: T[]): T | Generates a random element from an array | | generateRandomDate(start: Date, end: Date): Date | Generates a random date within a given range | | generateRandomColor(): string | Generates a random RGB color value | | generateRandomHexColor(): string | Generates a random hexadecimal color value | | shuffleArray<T>(array: T[]): T[] | To shuffle an array randomly | | generateEmailAddress(): string | Generates a random email address | | generateGUID(): string | Generates a random GUID (Globally Unique Identifier) | | generateIPv4Address(): string | Generates a random IPv4 address | | generateMACAddress(): string | Generates a random MAC address | | generateUUID(): string | Generates a random UUID (Universally Unique Identifier) | | generateRandomTime(): string | Generates a random time in 24-hour format | | generatePhoneNumber(): string | Generates a random phone number | | generateFileName(extension: string): string | Generates a random file name with extension | | generateURL(): string | Generates a random URL | | generateCurrencyCode(): string | Generates a random currency code | | generateJobTitle(): string | Generate a random job title | | generateCreditCardNumber(): string | Generates a random credit card number (dummy) | | generateCountry(): string | Generates a random country | | generateBooleanWithProbability(probability: number): boolean | Generates a random boolean value with a given probability | | generatePassword(length: number, includeUppercase: boolean, includeNumbers: boolean, includeSymbols: boolean): string | Generates a random password with a given length and complexity | | generateUsername(): string | Generates a random username | | generateAddress(): string | Generates a random address | | generateSentence(wordCount: number): string | Generates a random sentence | | generateParagraph(sentenceCount: number, wordsPerSentence: number): string | Generates a random paragraph | | generateSlug(title: string): string | Generates a random URL slug | | generateAvatar(avatarSize = 200): string | Generates a random avatar URL | | generateSocialMediaHandle(): string | Generates a random social media handle | | generateISBN(): string | Generates a random ISBN (International Standard Book Number) | | generateMovieTitle(): string | Generates a random movie title | | generateBookTitle(): string | Generates a random book title | | generateQuote(): string | Generates a random quote | | generateLicensePlate(): string | Generates a random license plate number | | generateCompanyName(): string | Generates a random company name | | generateTwitterHandle(): string | Generates a random Twitter handle | | generateSSN(): string | Generates a random social security number | | generateRegistrationNumber(): string | Generates a random vehicle registration number | | generateDomainName(): string | Generates a random domain name | | generateFruit(): string | Generates a random fruit | | generateProgrammingLanguage(): string | Generates a random programming language | | generateUniversityName(): string | Generates a random university name | | generateSportsTeamName(): string | Generates a random sports team name | | generateProgrammingFramework(): string | Generates a random programming framework | | generateZodiacSign(): string | Generates a random Zodiac sign | | generateJobIndustry(): string | Generates a random job industry | | generateCurrencySymbol(): string | Generates a random currency symbol | | generateJobLevel(): string | Generates a random job level | | generateVehicleMake(): string | Generates a random vehicle make | | generateTimeZone(): string | Generates a random time zone |
License
This package is open-source and released under the MIT License.