randomner

Random lib for JavaScript

Randomner

Randomner is an library for Node.JS which provide powerful function for using random values.

You can install Randomner-Js with the npm:

npm install randomner

Generates random integer between min and max

Arguments

  • min - An minimal value of result.
  • max - An maximum value of result.

Example

// Generates random integer between 5 and 10 
var randomner = require('randomner');
var randomInteger = randomner.randInt(5, 10);

Generates random float between min and max

Arguments

  • min - An minimal value of result.
  • max - An maximum value of result.

Example

// Generates random float between 2.10 and 3.14 
var randomner = require('randomner');
var randomFloat = randomner.randInt(2.10, 3.14);

Generates random string with length between min and max

Arguments

  • min - An minimal length of result string.
  • max - An maximum length of result string.

Example

// Generates random string with length between 10 and 42 
var randomner = require('randomner');
var randomString = randomner.randString(10, 42);

Generates random HEX-code of color

Example

// Generates random HEX-code of color 
var randomner = require('randomner');
var randomHEXColor = randomner.randHexColor();

Generates random json of rgb-color

Example

// Generates random json of rgb-color 
var randomner = require('randomner');
var randomRgbColor = randomner.randRgbColor();

// Generates random Top-level domain zone

Example

// Generates random Top-level domain zone 
var randomner = require('randomner');
var randomZone = randomner.randTld();

Generates random Top-level domain

Arguments

  • min - An minimal length name of domain.
  • max - An maximum length name of domain.

Example

// Generates random Top-level domain 
var randomner = require('randomner');
var randomDomain = randomner.randDomain({min: 5, max: 14});

Generates random email

Arguments

  • min - An minimal length name of user and domain.
  • max - An maximum length name of user and domain.

Example

// Generates random email 
var randomner = require('randomner');
var randomEmail = randomner.randEmail({min: 5, max: 14});

Generates random IPv4 address

Example

// Generates random IPv4 address 
var randomner = require('randomner');
var randomIPv4 = randomner.randIpv4Ip();

Return pm or am

Example

// Return pm or am 
var randomner = require('randomner');
var randomTime = randomner.randTimeAmPm();

Generates random month

Example

// Generates random month 
var randomner = require('randomner');
var randomMonth = randomner.randMonth();

Generates random timestamp

Example

// Generates random timestamp 
var randomner = require('randomner');
var randomTimestamp = randomner.randTimeStamp();

Generates JavaScript object Date with random DateTime

Example

// Generates JavaScript object Date with random DateTime 
var randomner = require('randomner');
var randomDatetime = randomner.randDateTime();

Generates random coordinates

Example

// Generates random coordinates 
var randomner = require('randomner');
var randomCoordinates = randomner.randCoordinates();

Generates random country

Example

// Generates random country 
var randomner = require('randomner');
var randomCountry = randomner.randCountry();

Generates random name If gender not presented - it will be selected randomly.

Example

// Generates random name 
var randomner = require('randomner');
var randomName = randomner.randName();

Returns random element from array

Example

// Returns random element from array 
var randomner = require('randomner');
var array = ["a", "b", "c"];
var randomElement = randomner.randElement(array);