lib/libs/string.js
function randomString(_string_length, _mode) {
    
    var string_length = _string_length;
    if(string_length < 3)
    	string_length = 2;
    
    var chars = chars_all;
    
    if(_mode === 'lower_case') chars = chars_lower;
    else if(_mode === 'upper_case') chars = chars_upper;
    else if(_mode === 'nums_oly') chars = chars_nums;
    else if(_mode === 'especials') chars = chars_all + chars_spec;
    
    var str = '';
    for (var i=0; i<string_length; i++) {
        var rnum = Math.floor(Math.random() * chars.length);
        str += chars.substring(rnum,rnum+1);
    }
    
    return str;
}
function randomString(_string_length, _mode) {
    
    var string_length = _string_length;
    if(string_length < 3)
    	string_length = 2;
    
    var chars = chars_all;
    
    if(_mode === 'lower_case') chars = chars_lower;
    else if(_mode === 'upper_case') chars = chars_upper;
    else if(_mode === 'nums_oly') chars = chars_nums;
    else if(_mode === 'especials') chars = chars_all + chars_spec;
    
    var str = '';
    for (var i=0; i<string_length; i++) {
        var rnum = Math.floor(Math.random() * chars.length);
        str += chars.substring(rnum,rnum+1);
    }
    
    return str;
}
function randomString ( _string_length , _mode ) { var string_length = _string_length ; if ( string_length < 3 ) string_length = 2 ; var chars = chars_all ; if ( _mode === 'lower_case' ) chars = chars_lower ; else if ( _mode === 'upper_case' ) chars = chars_upper ; else if ( _mode === 'nums_oly' ) chars = chars_nums ; else if ( _mode === 'especials' ) chars = chars_all + chars_spec ; var str = '' ; for ( var i = 0 ; i < string_length ; i ++ ) { var rnum = Math . floor ( Math . random ( ) * chars . length ) ; str += chars . substring ( rnum , rnum + 1 ) ; } return str ; }
Generates a random string of the provided length, and including only
the required characters.

@param {int} _string_length
@param {String} _mode
@api public
Generates a random string of the provided length and including only the required characters .