Skip to content

dimitriwalters/randomit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

randomit

A small javascript library to generate random numbers in various situations along with other pieces of data which needs to be randomized.

Installation

npm install randomit

or

<script src="http://dimitriwalters.github.io/randomit/randomit.min.js"></script>

Usage

var randomit = require('randomit');

randomit.generateNumber();          // number between 1 to 10
randomit.generateNumber(10);        // number between 1 to 10
randomit.generateNumber(1, 10);     // number between 1 to 10
randomit.generateNumber(1, 10, 3);  // array with 3 numbers between 1 to 10

randomit.generateNumberDigits(2);       // number with two digits
randomit.generateNumberDigits(2, 3);    // array with 3 two-digit numbers

randomit.getRandomItem([0, 1, 2, 3, 5]);                    // one of those fibonacci numbers
randomit.getRandomItem(['Hi!', 'Hey!', 'Hello!', 'Ahoy!']); // one of those greetings
randomit.getRandomItem([0, 1, 2, 3, 5], 3);                 // array with three of those numbers

License

Licensed under MIT.

About

Javascript library to randomize data

Resources

Stars

Watchers

Forks

Packages

No packages published