nl_tokens: Generates a random string of text of a given length . Will generate an alpha - numeric string unless you specify a different character set as the second argument
pl_tokens: function randomString ( length , charSet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789' ) { let str = '' , isAllNumeric = false , isNegative = false , useCharSet = charSet ; if ( + length ) { if ( ! isString ( charSet ) ) { if ( isNumber ( charSet ) ) { if ( + charSet ) { isAllNumeric = true ; isNegative = + charSet < 0 ; useCharSet = ` ${ Math . <mask> ( + charSet ) } ` ; } else { useCharSet = ALPHANUMERIC_CHARS ; } } else { useCharSet = ALPHANUMERIC_CHARS ; } } const generateChar = function gc ( len ) { return Math . round ( Math . random ( ) * ( len - 1 ) ) ; } . bind ( null , useCharSet . length ) ; str = Array ( + length ) . fill ( ) . map ( ( v , index ) => { const newChar = generateChar ( ) ; /* If we are generating a random number, make sure the first digit is not zero */ if ( ! index && isAllNumeric && ! newChar ) { return useCharSet . charAt ( newChar + 1 ) ; } return useCharSet . charAt ( newChar ) ; } ) . join ( '' ) ; } if ( isAllNumeric ) { return isNegative ? - + str : + str ; } return str ; }