A versatile random data generation library for JavaScript applications.
Using npm:
npm install anoverse
Using yarn:
yarn add anoverse
Using pnpm:
pnpm add anoverse
Using Bun:
bun add anoverse
First, import and initialize the library:
import anoverse from "anoverse";
const ano = anoverse();
Generates a random integer from 0 to max (inclusive).
console.log(ano.generateRandomNumber(88)); // Example output: 42
Returns an array of integers from 0 to max-1.
console.log(ano.getRange(8)); // Output: [0, 1, 2, 3, 4, 5, 6, 7]
Generates a random string of alphabetic characters of the specified length.
console.log(ano.generateRandomAlpha(6)); // Example output: "XwBrTq"
Generates a random string of alphanumeric characters of the specified length.
console.log(ano.generateRandomAlphaNumeric(10)); // Example output: "a7Bf9X2p0Z"
Generates a random string of symbols of the specified length.
console.log(ano.generateRandomSymbol(3)); // Example output: "#@!"
Generates a one-time password (numeric) of the specified length.
console.log(ano.generateOTP(4)); // Example output: "5382"
Generates a UUID (Universally Unique Identifier).
console.log(ano.generateUUID()); // Example output: "f47ac10b-58cc-4372-a567-0e02b2c3d479"
Returns a random boolean value (true or false).
console.log(ano.getRandomBoolean()); // Example output: true
Returns a random item from the provided array.
console.log(ano.getRandomItem(['red', 'blue', 'green'])); // Example output: "blue"
Returns a new array with the elements of the provided array in a random order.
console.log(ano.shuffleArray([1, 2, 3, 4, 5])); // Example output: [3, 1, 5, 2, 4]
Generates a random date.
console.log(ano.getRandomDate()); // Example output: 2023-05-17T14:32:17.123Z
MIT