Get Random Numbers, Names, Dates and much more.
- random-in
- Table of Contents
- Installation
- Numbers
- Names
- Get Random Name
- Get Random Male Name
- Get Random Female Name
- Get Random Male First Name
- Get Random Female First Name
- Get Random Last Name
- Get Random Indian Name
- Get Random Indian Male Name
- Get Random Indian Female Name
- Get Random Indian Male First Name
- Get Random Indian Female First Name
- Get Random Indian Last Name
- Dates
- Emails
- Passwords
- Country
- Color
- Programming
- Table of Contents
npm install random-in
getNDigit(n) --> n is number of digits
const { getNDigit } = require('random-in');
console.log(getNDigit(5)); // 24646
getRandomBetween(min, max) ---> to get a random number between min and max
Note: min and max are inclusive i.e. getRandomBetween(1,100) may return 1 or 100
const { getRandomBetween } = require('random-in');
console.log(getRandomBetween(5, 50)); // 26
getRandomFloatBetween(min, max) --> to get a random floating number between min and max
const { getRandomFloatBetween } = require('random-in');
console.log(getRandomFloatBetween(5, 50)); // 19.69726289036264
getNRandomBetween(n, min, max) --> to get n random numbers between min and max
const { getNRandomBetween } = require('random-in');
console.log(getNRandomBetween(5, 1, 50)); // [34, 23, 28, 6, 14]
Get random users name
Get a random full name of any gender
const { getName } = require('random-in');
console.log(getName()); // "Winnifred Struble"
Get a random full name (Male)
const { getMaleName } = require('random-in');
console.log(getMaleName()); // "Derek Gilstrap"
Get a random full name (Female)
const { getFemaleName } = require('random-in');
console.log(getFemaleName()); // "Gerri Bavaro"
Get a random first name (Male)
const { getMaleFirstName } = require('random-in');
console.log(getMaleFirstName()); // Jamey
Get a random first name (Female)
const { getFemaleFirstName } = require('random-in');
console.log(getFemaleFirstName()); // "Beckie"
Get a random last name
const { getLastName } = require('random-in');
console.log(getLastName()); // "Reinbold"
Get a random Indian full name of any gender
const { getIndianName } = require('random-in');
console.log(getIndianName()); // "Nagendra Shankar"
Get a random Indian full name (Male)
const { getIndianMaleName } = require('random-in');
console.log(getIndianMaleName()); // "Ashok Dalal"
Get a random Indian full name (Female)
const { getIndianFemaleName } = require('random-in');
console.log(getIndianFemaleName()); // "Deepali Bose"
Get a random Indian first name (Male)
const { getIndianMaleFirstName } = require('random-in');
console.log(getIndianMaleFirstName()); // "Mukul"
Get a Random Indian first name (Female)
const { getIndianFemaleFirstName } = require('random-in');
console.log(getIndianFemaleFirstName()); // "Anandi"
Get a random Indian last name
const { getIndianLastName } = require('random-in');
console.log(getIndianLastName()); // "Pant"
Get Random Dates
Get a random date between two dates
Note: new Date(YYYY, MM, DD) If month is less than 10, let's say 4, use 4 instead of 04 If date is less than 10, let's say 6, use 6 instead of 06
const { getDateBetween } = require('random-in');
console.log(getDateBetween(new Date(1947, 8, 15), new Date()));
// Tue Aug 07 1956 10:42:05 GMT+0530 (India Standard Time)
Get a random date from future
Note: Default future date limit is 50 years from current date. getRandomDateFuture(futureYear). futureYear is of type "number".
const { getRandomDateFuture } = require('random-in');
console.log(getRandomDateFuture(2021));
// 2021-07-22T00:50:23.025Z
Get Random Email Address
Get a random email id
const { getRandomEmail } = require('random-in');
console.log(getRandomEmail()); // "agnuskloster@yomail.com"
Get Random Passwords
Get a random alphanumeric password of n length
const { getAlphanumericPassword } = require('random-in');
console.log(getAlphanumericPassword(8)); // "IVYs4uI9"
Get a random lowercase alphanumeric password of n length
const { getLowercasePassword } = require('random-in');
console.log(getLowercasePassword(8)); // "ffm690dx"
Get a random uppercase alphanumeric password of n length
const { getUppercasePassword } = require('random-in');
console.log(getUppercasePassword(8)); // "S7PM8AOO"
Get a random only alphabet password of n length
const { getAlphaPassword } = require('random-in');
console.log(getAlphaPassword(8)); // "juYyjMJs"
Get a random only lowercase alphabets password of n length
const { getAlphaLowercasePassword } = require('random-in');
console.log(getAlphaLowercasePassword(8)); // "stysfpbs"
Get a random only uppercase alphabets password of n length
const { getAlphaUppercasePassword } = require('random-in');
console.log(getAlphaUppercasePassword(8)); // "ZHKNQYTY"
Get a random numeric password of n length
const { getNumericPassword } = require('random-in');
console.log(getNumericPassword(8)); // "94970880"
Get Random Country
Get a random country name
const { getCountry } = require('random-in');
console.log(getCountry()); // "United Kingdom"
Get Random Color
Get a random hex color
const { getRandomColorHex } = require('random-in');
console.log(getRandomColorHex()); // "#94FA02"
Get random programming stuff
Get a random programming language
const { getRandomProgrammingLanguage } = require('random-in');
console.log(getRandomProgrammingLanguage()); // "Julia"