Skip to content

QwertyR0/ezrandom

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ezrandom

ezrandom is a simple pseudo random number generator library.

node

📦Installation

npm i @qwertyr0/ezrandom
# or:
npm i git+https://github.com/QwertyR0/ezrandom.git

👩‍💻USAGE:

import ezRandom from "@qwertyr0/ezrandom";

//random numbers:
ezRandom.genInt(1, 3);
//-> 1

ezRandom.genInt(1, 3, 4);
//-> [1, 3, 2, 3]

ezRandom.genFloat(1, 3);
//-> 2.345

// random selection:
ezRandom.selection(["a", "b"], 1);
//-> ["a"]

// probability:
ezRandom.probability(1, 10, 3, 4);
//-> 1.39

// random password:
ezRandom.password({
    passLength: 11
});
//-> naxohnjykom

// Array shuffle:
ezRandom.shuffle([12, 53, 44, 23]);
//-> [44, 12, 23, 53]

// random rgb color value:
ezRandom.ranColor.rgb();
//-> [52, 7, 109]

// random hex color value:
ezRandom.ranColor.hex();
//-> "#a97b30"

/*
 There are more options that are not shown here
 but it's documented with jsdoc in "main.js"
*/

👔Maintainer

QwertyR0

QwertyR0


🐛Bugs:

Create an issue here

LICENSE: MIT