Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

js-random-generator

Package Overview
Dependencies
Maintainers
0
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

js-random-generator

Useful Random Generator

  • 1.0.4
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
10K
decreased by-53.76%
Maintainers
0
Weekly downloads
 
Created
Source

js-random-generator

You can generate random number, text, password or value that you want with custom length easily.

List of Features

  • Generate a random number (custom length)
  • Generate a random text (custom length)
  • Generate a random password (custom length)
  • Generate a random value (custom length)

Download & Installation

$ npm i js-random-generator

Example Usage

const {generateRandom, generateRandomNumber, generateRandomText, generateRandomPassword, getRandomNumberBetween} = require('js-random-generator')

const min = 5
const max = 10

const randomNumberBetween = getRandomNumberBetween(min,max)
console.log(randomNumberBetween) // output: 7


const length = 8 // custom length

const randomNumber = generateRandomNumber(length)
console.log(randomNumber) // output: 10462678

const randomTextOnlyUpper = generateRandomText(length,false) // only upper case characters
console.log(randomTextOnlyUpper) // output: EBLKEWMK

const randomTextWithLower = generateRandomText(length,true) // includes lower case characters
console.log(randomTextWithLower) // output: EPugSiwN

const randomPassword = generateRandomPassword(length)
console.log(randomPassword) // output: y7SHvb_Q


const characterSet = 'qwerasdfzxcv' // custom character set

const randomValue = generateRandom(length,characterSet) // you can generate a random value with your custom character set
console.log(randomValue) // output: dcwzavdr


// Error => returns null

License

This project is licensed under the MIT License

Keywords

FAQs

Package last updated on 31 Oct 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc