README
randomatic
Generate randomized strings of a specified length using simple character sequences. The original generate-password.
Please consider following this project's author, Jon Schlinkert, and consider starring the project to show your :heart: and support.
Install
Install with npm:
$ npm install --save randomatic
Usage
var randomize = require('randomatic');
API
randomize(pattern, length, options);
randomize.isCrypto;
pattern
{String}: (required) The pattern to use for randomizinglength
{Number}: (optional) The length of the string to generateoptions
{Object}: (optional) See available optionsrandomize.isCrypto
will betrue
when a cryptographically secure function is being used to generate random numbers. The value will befalse
when the function in use isMath.random
.
pattern
The pattern to use for randomizing
Patterns can contain any combination of the below characters, specified in any order.
Example:
To generate a 10-character randomized string using all available characters:
randomize('*', 10);
//=> 'x2_^-5_T[