Installation
$ npm install randomize
Usage
Random Integer:
2 Parameters.
- minNumber - optional (Default value : 1)
- maxNumber - optional (Default value : 100)
Syntax : randomInteger(minNumber, maxNumber)
var randomize = ; ## `if you want 3 digit random code than use like this:`console;//» 441//» 568 ## `if you want 4 digit random code than use like this:` console;//» 5036//» 6493 ## `if you want 6 digit random code than use like this:` console;//» 539864//» 459781
Random Float:
3 Parameters.
- minNumber - optional (Default value : 1)
- maxNumber - optional (Default value : 10000)
- fraction - optional (Default value : 2)
Syntax : randomFloat(minNumber, maxNumber, fraction)
var randomize = ; ## `if you want 3 digit random float code than use like this:` console;//» 441.32//» 568.45 ## `if you want 4 digit random float code than use like this:` console;//» 5036.32//» 6493.65 ## `if you want 3 number after .(dot) than use like this:` console;//» 5036.327//» 6493.651 ## `if you want 1 number after .(dot) than use like this:` console;//» 5036.3//» 6493.6
Random Boolean:
Syntax : randomBoolean()
var randomize = ; console;//» false//» true//» true//» false
Random String or Random Password Generator:
4 Parameters.
- length - optional (Default value : 8)
- isCapitalAllow - optional (Default value : false)
- isNumberAllow - optional (Default value : false)
- isSpecialCharAllow - optional (Default value : false)
Syntax : randomString(length, isCapitalAllow, isNumberAllow, isSpecialCharAllow)
var randomize = ; console;//» wltvqprk ## `if you want 10 character random string than use like this:` console;//» rqmflwrusp ## `if you want capital letter in random string than use like this:` console;//» kYbQYlpoX ## `if you want capital letter and digit in random string than use like this:` console;//» 6YbQ9lpoX ## `if you want capital letter, digit and special character in random string than use like this:` console;//» 6Je*w#Lq
Random Array:
1 Parameters.
- length - optional (Default value : 10)
Syntax : randomArray(length)
var randomize = ; console;//» [1,44,56,32,87,71,41,69,51,70] ## `if you want 5 element in array than use like this:` console;//» [1,44,56,32,87]
Random String Array:
4 Parameters.
- length - optional (Default value : 5)
- minStringLength - optional (Default value : 5)
- maxStringLength - optional (Default value : 10)
- isSpaceAllow - optional (Default value : true)
Syntax : randomStringArray(length, minStringLength, maxStringLength, isSpaceAllow)
var randomize = ; console;//» ['A Q','kMhg na','HRtmFGu','lc GWR',' O A ca'] ## `if you want 3 element and string length is in between 10 to 20 in array than use like this:` console;//» ['s EvprF lJx kE',' QsWuyjjcEDt e',' aVdAGjhveSbN']
Random or Unique Image Name:
2 Parameters.
- prefix - optional (Default value : "")
- suffix - optional (Default value : "")
Syntax : uniqueImageName(prefix, suffix)
var randomize = ; console;//» 1591685161249 ## `if you want prefix in image name than use like this:` console;//» profile_1591685161249 ## `if you want suffix in image name than use like this:` console;//» 1591685161249_img ## `if you want prefix and suffix in image name than use like this:` console;//» profile_1591685161249_img
Random RGB Color:
Syntax : randomRGBColor()
var randomize = ; console;//» rgb(255, 10, 34)
Random HEX Color:
Syntax : randomHEXColor()
var randomize = ; console;//» #ff0000
Random HSL Color:
Syntax : randomHSLColor()
var randomize = ; console;//» hsl(0, 100%, 50%)
Who contributed?
[ anil_bhadani99 ]