deeprand v2.2.5
deepRand.js
A light and expandable Javascript library with a high confidence in generating unique pseudo-random values at runtime.
NOTE: This library does not generate GLOBALLY random values that can be guaranteed to be random every time it's ran. Please do not use this library in code meant for sensitive functions (user logins, password encrypting, etc.) I am not responsible for breaches of security on your platform involving my library.
Browser Support
deepRand.js is only supported in browsers that can run ECMAScript 6+. Use this link to see a list of browsers that support ECMAScript 6.
(NOTE: I have no plans to support ECMAScript 5 or below with deepRand.js. If you're getting errors by using deepRand.js, please try upgrading your browser and using a browser other than IE11.)
How To Use
Below are the different functions and their available options:
randomNum(length)
- generates a random number string of specified length.length
-Number
, used to denotate the length of the outputted string.
randomStr(length, useUppercase, useLowercase, useNumbers, useSymbols)
- generates a random text string of specified length and complexity.length
-Number
, used to denotate the length of the outputted string.useUppercase
-Boolean
, used to toggle the use of UPPERCASED letters in final string.useLowercase
-Boolean
, used to toggle the use of lowercased letters in final string.useNumbers
-Boolean
, used to toggle the use of numbers in final string.useSymbols
-Boolean
, used to toggle the use of symbols in final string.
randomHex(length, isPrefixed, caseType)
- generates a random hex string of specified length (that must be a power of 8).length
-Number
, used to denotate the length of the outputted string.isPrefixed
-Boolean
, if set totrue
, outputted string will have0x
appended to the start of the string.caseType
-String
, if set to"uppercase"
, outputted string will have all letters uppercased, if set to"lowercase"
, outputted string will have all letters lowercased.
Remember! If you use deepRand.js, pay attention to the attached license for information on the limitations of usage and distribution.