Skip to Content
๐ŸŽฒ Welcome to RandBox - Powerful JavaScript Random Data Generation Library! Learn More
๐Ÿ“ฆ Some ExamplesRandBox Documentation

RandBox Documentation

RandBox is a powerful JavaScript random data generation library, providing a rich API for generating various types of random data. This document covers all of RandBoxโ€™s functional modules and usage methods.

usage - Usage Methods

How to install and use RandBox in different environments:

  1. bower.mdx - Installation and usage method for the Bower package manager
  2. browser.mdx - Usage methods in a browser environment (simple, intermediate, advanced)
  3. requirejs.mdx - RequireJS module loading method
  4. node.mdx - Installation and usage in a Node.js environment (npm, yarn, ES6)
  5. function.mdx - Instructions for using custom random functions
  6. cli.mdx - Command Line Interface installation and usage method
  7. seed.mdx - Detailed explanation of seed functionality (number, string, multi-parameter seed)

basics - Basic Data Types

Basic data type generation functionality:

  1. bool.mdx - Generate a random boolean value, supports specifying probability
  2. character.mdx - Generate a random character, supports options like letters, numbers, symbols
  3. falsy.mdx - Generate JavaScript falsy values
  4. floating.mdx - Generate a random floating-point number, supports range and precision settings
  5. integer.mdx - Generate a random integer, supports minimum and maximum settings
  6. letter.mdx - Generate a random letter, supports case control
  7. natural.mdx - Generate a natural number (non-negative integer)
  8. prime.mdx - Generate a random prime number
  9. string.mdx - Generate a random string, supports multiple options like length, character pool, case
  10. template.mdx - Generate a string based on a template, supports placeholder replacement

finance - Financial Data

Financial related data generation functionality:

  1. cc.mdx - Generate a random credit card number compliant with the Luhn algorithm, supports specifying card type
  2. cc_type.mdx - Get credit card type information, including full name and abbreviation
  3. currency.mdx - Generate a random currency code or name
  4. currency_pair.mdx - Generate a random currency pair
  5. dollar.mdx - Generate a random US dollar amount, supports maximum value setting
  6. euro.mdx - Generate a random Euro amount, supports maximum value setting
  7. exp.mdx - Generate a credit card expiration date (MM/YY format)
  8. exp_month.mdx - Generate a credit card expiration month (01-12)
  9. exp_year.mdx - Generate a credit card expiration year, supports 2-digit or 4-digit format

helpers - Helper Tools

Practical helper functions and data manipulation tools:

  1. capitalize.mdx - Capitalize the first letter of a word
  2. pick.mdx - Deprecated selection function, recommend using pickone and pickset
  3. pickset.mdx - Select multiple random elements from an array
  4. pickone.mdx - Select one random element from an array
  5. shuffle.mdx - Shuffle the order of an array
  6. pad.mdx - Number padding functionality
  7. set.mdx - Override default data sets
  8. mixin.mdx - Mixin functionality, used to extend RandBox

location - Geographical Location

Geographical location and address related data generation:

  1. address.mdx - Generate a random street address
  2. altitude.mdx - Generate a random altitude
  3. areacode.mdx - Generate a random area code (USA)
  4. city.mdx - Generate a random city name
  5. coordinates.mdx - Generate random coordinates (latitude and longitude)
  6. country.mdx - Generate a random country code or full name
  7. depth.mdx - Generate a random depth (negative number)
  8. geohash.mdx - Generate a random geohash
  9. latitude.mdx - Generate a random latitude
  10. locale.mdx - Generate a random language code or regional code
  11. longitude.mdx - Generate a random longitude
  12. phone.mdx - Generate a random phone number (supports USA, UK, France)
  13. postal.mdx - Generate a Canadian postal code
  14. postcode.mdx - Generate a UK postcode
  15. province.mdx - Generate a random province (supports Canada, Italy)
  16. state.mdx - Generate a random state (supports USA, Italy)
  17. street.mdx - Generate a random street name
  18. zip.mdx - Generate a US ZIP code

miscellaneous - Miscellaneous Tools

Various practical random data generation tools:

  1. coin.mdx - Coin toss functionality
  2. dice.mdx - Dice functionality (d4, d6, d8, d10, d12, d20, d30, d100)
  3. fileWithContent.mdx - Generate a file with random content
  4. guid.mdx - Generate a random GUID (versions 4 and 5)
  5. hash.mdx - Generate a random hexadecimal hash
  6. hidden.mdx - Internal utility methods (credit card types, Mersenne Twister, months, etc.)
  7. n.mdx - Generate an array of a specified number of random items
  8. normal.mdx - Normal distribution random number generation
  9. radio.mdx - Generate a random radio call sign
  10. rpg.mdx - RPG dice system (e.g., 3d10)
  11. tv.mdx - Generate a TV station call sign (alias for radio)
  12. unique.mdx - Generate an array of unique items
  13. weighted.mdx - Weighted random selection

mobile - Mobile Devices

Mobile device identifier generation:

  1. android_id.mdx - Generate a random GCM registration ID
  2. apple_token.mdx - Generate a random Apple Push Token
  3. bb_pin.mdx - Generate a random BlackBerry device PIN
  4. wp7_anid.mdx - Generate a random Windows Phone 7 ANID
  5. wp8_anid2.mdx - Generate a random Windows Phone 8 ANID2

music - Music

Music-related data generation:

  1. music_genre.mdx - Generate a random music genre, includes 22 main genres and over 600 subgenres
  2. note.mdx - Generate a random musical note, supports various options (flats, sharps, natural notes, etc.)
  3. tempo.mdx - Generate a random tempo (default 40-320 BPM)

person - Personal Information

Personal information and identity-related data generation:

  1. aadhar.mdx - Generate an Indian identity number (Aadhar)
  2. age.mdx - Generate a random age, supports different types (child, teen, adult, senior)
  3. birthday.mdx - Generate a random birthday, supports multiple formats and types
  4. cf.mdx - Generate an Italian social security number (Codice Fiscale)
  5. cpf.mdx - Generate a Brazilian tax number
  6. first.mdx - Generate a random first name, supports gender and nationality limits
  7. gender.mdx - Generate a random gender, supports additional gender options
  8. last.mdx - Generate a random last name, supports multiple nationalities
  9. name.mdx - Generate a full random name, supports middle name, prefix, suffix options
  10. prefix.mdx - Generate a random name prefix (e.g., Mr., Mrs.)
  11. ssn.mdx - Generate a US Social Security Number
  12. suffix.mdx - Generate a random name suffix (e.g., Jr., Sr.)
  13. zodiac.mdx - Generate a random zodiac sign

text - Text Generation

Text and language related content generation:

  1. emoji.mdx - Generate a random emoji, supports specifying category and length
  2. paragraph.mdx - Generate a random paragraph, composed of semi-pronounceable nonsense words, supports specifying sentence count and newline option
  3. sentence.mdx - Generate a random sentence, composed of semi-pronounceable nonsense words, supports specifying word count
  4. syllable.mdx - Generate semi-pronounceable syllables, used as building blocks for words
  5. word.mdx - Generate a semi-pronounceable random word, supports specifying syllable count or length (mutually exclusive options)

thing - Entities

Generation of various entities:

  1. animal.mdx - Generate a random animal name, supports specifying specific types (marine, desert, grassland, forest, farm, pet, zoo)

time - Date and Time

Date and time related data generation:

  1. ampm.mdx - Generate AM or PM identifier
  2. date.mdx - Generate a random date, supports multiple formats and specified components
  3. hammertime.mdx - Generate a Unix timestamp with milliseconds
  4. hour.mdx - Generate a random hour (12-hour or 24-hour format)
  5. millisecond.mdx - Generate a random millisecond between 0-999
  6. minute.mdx - Generate a random minute between 0-59
  7. month.mdx - Generate a random month, supports raw object format
  8. second.mdx - Generate a random second between 0-59
  9. timestamp.mdx - Generate a standard Unix timestamp
  10. timezone.mdx - Generate a random timezone information object
  11. weekday.mdx - Generate a weekday, supports limiting to weekdays
  12. year.mdx - Generate a random year, supports range limits

Web and internet related data generation:

  1. avatar.mdx - Generate a Gravatar avatar URL
  2. color.mdx - Generate a color, supports 6 color formats (hex, rgb, rgba, etc.)
  3. company.mdx - Generate a random company name
  4. domain.mdx - Generate a random domain name
  5. email.mdx - Generate a random email address
  6. fbid.mdx - Generate a Facebook ID
  7. google_analytics.mdx - Generate a Google Analytics tracking code
  8. hashtag.mdx - Generate a random hashtag
  9. ip.mdx - Generate a random IP address
  10. ipv6.mdx - Generate a random IPv6 address
  11. klout.mdx - Generate a Klout score
  12. mac.mdx - Generate a MAC address
  13. profession.mdx - Generate a random profession, supports rank options
  14. tld.mdx - Generate a Top-Level Domain
  15. twitter.mdx - Generate a Twitter username
  16. url.mdx - Generate a URL, supports multiple custom options
Last updated on: