Skip to content
JavaScript
Find file
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
tests
README.md
index.html
randomize.js

README.md

An exercise in creating a random string generator helper function which provides some general all around usefulness. Now compatible with Node.js.

Usage

/* 
 * Random alphanumeric string (including special characters) of random length 
 * default max length of 10 chars
 */
var random = randomize();

/*
 * Random alphanumeric string of random length 
 * max limit of 30 chars
 */
var random = randomize('alphanum', 30);

/*
 * Random numeric string with a fixed character length of 10 chars
 */
var random = randomize('num', 10, true);

Arguments

  • type String - Character type

    • num - numeric (0 - 9)
    • alphalc - alphabetic lowercase (a - z)
    • alphauc - alphabetic uppercase (A - Z)
    • alpha - alphabetic in both lowercase and uppercase (a - z, A - Z)
    • alphanum - alphanumeric (a - z, A - Z, 0 - 9)
    • special - special chars (!, @, #, etc.)
    • all (default) - outputs all alphanumeric and special characters
  • max Number - Max length of generated string (default of 10)

  • fixed Boolean - Generate to a fixed length? (default of false)

Something went wrong with that request. Please try again.