1.0.7 • Published 3 years ago

@keita-sama69/random v1.0.7

Weekly downloads
-
License
ISC
Repository
-
Last release
3 years ago

A simple randomization module

Package intended for people who don't want to type Math.floor(Math.random() * value) or something similar.

Usage

Run npm i @keita-sama69/random to install the package then to use it:

const { pickRandom, getNum } = require('@keita-sama69/random');
require('@keita-sama69/random') // For appending .random() to arrays
const num = 10;
const arr = ['kinda', 'lame', 'but', 'exists'];
const str = 'hello world';

console.log(pickRandom(num));
//Expected Output: Number between 0 - 10.

console.log(pickRandom(arr));
//Expected Output: A string from the array.

console.log(pickRandom(str));
//Expected Output: A letter from the string.

console.log(arr.random())
//Expected Output: A string from the array.

// The getNum function gets a number between two numbers, simple.
console.log(getNum(69, 420))
//Expected Output: A number between 69 and 420.

Added:

  • ESM support

Planned:

  • Nothing
1.0.7

3 years ago

1.0.6

3 years ago

1.0.1-dev.1

4 years ago

1.0.0-dev.1

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago