A collection of functions which are generating random values of string
,
number
and boolean
types.
const { rand } = nuti;
// will print `true` or `false`
console.log(rand.bool());
const { rand } = nuti;
// returns a random string with default length containing only alphabetic chars.
const str_1 = rand.str(); // RDcLDbtM
// returns a random string with length of 15 containing only alphabetic chars.
const str_2 = rand.str(15); // kfBFewEhLdpeknd
// returns a random string with length of 7 and 'hex' encoding.
const str_3 = rand.str(7, 'hex'); // a92f60;
// returns a random string with default length and 'base64url' encoding.
const str_3 = rand.str('base64url'); // 8iPFjIJR;
const { rand } = nuti;
// returns a random number between 0 and 10
const numb_1 = rand.numb();
// returns a random number between 12 and 903
const numb_2 = rand.numb(12, 903);
const { rand } = nuti;
// returns a random date from 2 weeks ago until now (by default)
const date_1 = rand.date();
// returns a random date from 5 days ago until now
const date_2 = rand.date(5);