randine
TypeScript icon, indicating that this package has built-in type declarations

1.0.3 • Public • Published

🎲 Randoms

import Random from 'randine';

Random.int(1, 10) // 1..10 (including 10)
Random.float(1, 10) // 1..10 (excluding 10)
Random.boolean() // true or false
Random.string(10, /* alphabet */) // 10 random characters
Random.array([1, 4, 9]) // 1 or 4 or 9
Random.object({ a: 1, b: 2, c: 3 }) // ['b', 2] or ['c', 3] or ['a', 1]
Random.chance(.7 /* 70% */) // true or false
Random.list('a', 'b', 'c') // 'a' or 'b' or 'c'
Random.date() // random date

⚙ Custom random

import { R_ } from 'randine';
const Random = R_(Math.random);

Package Sidebar

Install

npm i randine

Weekly Downloads

1

Version

1.0.3

License

MIT

Unpacked Size

3.57 kB

Total Files

4

Last publish

Collaborators

  • limpix31