Skip to content

akulsr0/random-in

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

random-in

HitCount npm version MIT License PR's Welcome

Get Random Numbers, Names, Dates and much more.

Table of Contents

Installation

npm install random-in

Numbers

Get Random Integer of n Digit

getNDigit(n) --> n is number of digits

const { getNDigit } = require('random-in');
console.log(getNDigit(5)); // 24646

Get Random Integer in a given range

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

Get Random Floating number in a given range

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

Get N Random Number in a given range

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]

Names

Get random users name

Get Random Name

Get a random full name of any gender

const { getName } = require('random-in');
console.log(getName()); // "Winnifred Struble"

Get Random Male Name

Get a random full name (Male)

const { getMaleName } = require('random-in');
console.log(getMaleName()); // "Derek Gilstrap"

Get Random Female Name

Get a random full name (Female)

const { getFemaleName } = require('random-in');
console.log(getFemaleName()); // "Gerri Bavaro"

Get Random Male First Name

Get a random first name (Male)

const { getMaleFirstName } = require('random-in');
console.log(getMaleFirstName()); // Jamey

Get Random Female First Name

Get a random first name (Female)

const { getFemaleFirstName } = require('random-in');
console.log(getFemaleFirstName()); // "Beckie"

Get Random Last Name

Get a random last name

const { getLastName } = require('random-in');
console.log(getLastName()); // "Reinbold"

Get Random Indian Name

Get a random Indian full name of any gender

const { getIndianName } = require('random-in');
console.log(getIndianName()); // "Nagendra Shankar"

Get Random Indian Male Name

Get a random Indian full name (Male)

const { getIndianMaleName } = require('random-in');
console.log(getIndianMaleName()); // "Ashok Dalal"

Get Random Indian Female Name

Get a random Indian full name (Female)

const { getIndianFemaleName } = require('random-in');
console.log(getIndianFemaleName()); // "Deepali Bose"

Get Random Indian Male First Name

Get a random Indian first name (Male)

const { getIndianMaleFirstName } = require('random-in');
console.log(getIndianMaleFirstName()); // "Mukul"

Get Random Indian Female First Name

Get a Random Indian first name (Female)

const { getIndianFemaleFirstName } = require('random-in');
console.log(getIndianFemaleFirstName()); // "Anandi"

Get Random Indian Last Name

Get a random Indian last name

const { getIndianLastName } = require('random-in');
console.log(getIndianLastName()); // "Pant"

Dates

Get Random Dates

Get Random Date in between two 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 Random Date (Future)

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

Emails

Get Random Email Address

Get Random Email Id

Get a random email id

const { getRandomEmail } = require('random-in');
console.log(getRandomEmail()); // "agnuskloster@yomail.com"

Passwords

Get Random Passwords

Get Alphanumeric Password

Get a random alphanumeric password of n length

const { getAlphanumericPassword } = require('random-in');
console.log(getAlphanumericPassword(8)); // "IVYs4uI9"

Get Lowercase Password

Get a random lowercase alphanumeric password of n length

const { getLowercasePassword } = require('random-in');
console.log(getLowercasePassword(8)); // "ffm690dx"

Get Uppercase Password

Get a random uppercase alphanumeric password of n length

const { getUppercasePassword } = require('random-in');
console.log(getUppercasePassword(8)); // "S7PM8AOO"

Get Alpha Password

Get a random only alphabet password of n length

const { getAlphaPassword } = require('random-in');
console.log(getAlphaPassword(8)); // "juYyjMJs"

Get Alpha Lowercase Password

Get a random only lowercase alphabets password of n length

const { getAlphaLowercasePassword } = require('random-in');
console.log(getAlphaLowercasePassword(8)); // "stysfpbs"

Get Alpha Uppercase Password

Get a random only uppercase alphabets password of n length

const { getAlphaUppercasePassword } = require('random-in');
console.log(getAlphaUppercasePassword(8)); // "ZHKNQYTY"

Get Numeric Password

Get a random numeric password of n length

const { getNumericPassword } = require('random-in');
console.log(getNumericPassword(8)); // "94970880"

Country

Get Random Country

Get Random Country

Get a random country name

const { getCountry } = require('random-in');
console.log(getCountry()); // "United Kingdom"

Color

Get Random Color

Get Random Color

Get a random hex color

const { getRandomColorHex } = require('random-in');
console.log(getRandomColorHex()); // "#94FA02"

Programming

Get random programming stuff

Get random programming language

Get a random programming language

const { getRandomProgrammingLanguage } = require('random-in');
console.log(getRandomProgrammingLanguage()); // "Julia"

About

Get Random Numbers, Names, Dates and much more.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published