1.0.3 • Published 10 months ago

@namopanda/random-generator v1.0.3

Weekly downloads
-
License
MIT
Repository
-
Last release
10 months ago

Randomizer

Randomizer is an npm package that provides various randomization functions. It allows you to generate random numbers, shuffle arrays, select random elements, generate random strings, and more.

Installation

You can install the Randomizer package using npm:

npm install @namopanda/randomizer

Randomizer

Randomizer is an npm package that provides various randomization functions. It allows you to generate random numbers, shuffle arrays, select random elements, generate random strings, and more.

Installation

You can install the Randomizer package using npm:

npm install @namopanda/randomizer

Usage

Import the Randomizer package into your project:

const Randomizer = require('@namopanda/randomizer');

Generate a Random Number

Generate a random number between a minimum and maximum value (inclusive):

const randomNumber = Randomizer.generateRandomNumber(1, 10); console.log('Random Number:', randomNumber);

Shuffle an Array

Shuffle the elements in an array randomly:

const array = 1, 2, 3, 4, 5; const shuffledArray = Randomizer.shuffleArray(array); console.log('Shuffled Array:', shuffledArray);

Select a Random Element

Select a random element from an array:

const array = 1, 2, 3, 4, 5; const randomElement = Randomizer.selectRandomElement(array); console.log('Random Element:', randomElement);

Generate a Random String

Generate a random string of a specified length:

const randomString = Randomizer.generateRandomString(8); console.log('Random String:', randomString);

Generate a Random Boolean

Generate a random boolean value (true or false):

const randomBoolean = Randomizer.generateRandomBoolean(); console.log('Random Boolean:', randomBoolean);

Generate a Random RGB Color

Generate a random RGB color in the format "rgb(red, green, blue)":

const randomColor = Randomizer.generateRandomColor(); console.log('Random Color:', randomColor);

License

This project is licensed under the MIT License.

1.0.3

10 months ago

1.0.1

10 months ago

1.0.0

10 months ago