1.0.3 • Published 2 years ago

randine v1.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

🎲 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);