randplus

1.2.0 • Public • Published

randplus

A package that add functions for random.

Usage

const random = require('randplus');

console.log(random.random()); // 0 ~ 1 (!= 1)
console.log(random.number(1, 10)); // 1 ~ 10
console.log(random.integer(1, 10)); // 1 ~ 10
console.log(random.boolean()); // true or false
console.log(random.array(['Hello', 'World!'])); // 'Hello' or 'World!'
console.log(random.string(3)); // '000' ~ 'ZZZ'
console.log(random.string(3, 'abc')); // 'aaa' ~ 'ccc'
console.log(random.string(3, ['01', '02', '03'])); // '010101' ~ '030303'
console.log(random.shuffle('abcdef')); // 'cfeadb'
console.log(random.shuffle(['a', 'b', 'c', 'd', 'e', 'f'])); // ['c', 'f', 'e', 'a', 'd', 'b']
console.log(random.color('hex')); // '000000' ~ 'ffffff'
console.log(random.color('rgb')); // [0, 0, 0] ~ [255, 255, 255]

Get Support

Discord Banner

Package Sidebar

Install

npm i randplus

Weekly Downloads

8

Version

1.2.0

License

ISC

Unpacked Size

5.14 kB

Total Files

11

Last publish

Collaborators

  • otoneko.