npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

randomize-unique

v0.0.4

Published

Random Interger, Random Float, Random Boolean, Random String or Password, Random Array, Unique Image Name, Random RGB-HEX-HSL Color Generator

Downloads

3

Readme

Installation

$ npm install randomize

Usage

Random Integer:

2 Parameters.

  1. minNumber - optional (Default value : 1)
  2. maxNumber - optional (Default value : 100)

Syntax : randomInteger(minNumber, maxNumber)

var randomize = require("randomize-unique");

## `if you want 3 digit random code than use like this:`
console.log(randomize.randomInteger(100, 999));
//» 441
//» 568

## `if you want 4 digit random code than use like this:`

console.log(randomize.randomInteger(1000, 9999));
//» 5036
//» 6493

## `if you want 6 digit random code than use like this:`

console.log(randomize.randomInteger(100000, 999999));
//» 539864
//» 459781

Random Float:

3 Parameters.

  1. minNumber - optional (Default value : 1)
  2. maxNumber - optional (Default value : 10000)
  3. fraction - optional (Default value : 2)

Syntax : randomFloat(minNumber, maxNumber, fraction)

var randomize = require("randomize-unique");

## `if you want 3 digit random float code than use like this:`

console.log(randomize.randomFloat(100, 999));
//» 441.32
//» 568.45

## `if you want 4 digit random float code than use like this:`

console.log(randomize.randomFloat(1000, 9999));
//» 5036.32
//» 6493.65

## `if you want 3 number after .(dot) than use like this:`

console.log(randomize.randomFloat(1000, 9999, 3));
//» 5036.327
//» 6493.651

## `if you want 1 number after .(dot) than use like this:`

console.log(randomize.randomFloat(1000, 9999, 1));
//» 5036.3
//» 6493.6

Random Boolean:

Syntax : randomBoolean()

var randomize = require("randomize-unique");

console.log(randomize.randomBoolean());
//» false
//» true
//» true
//» false

Random String or Random Password Generator:

4 Parameters.

  1. length - optional (Default value : 8)
  2. isCapitalAllow - optional (Default value : false)
  3. isNumberAllow - optional (Default value : false)
  4. isSpecialCharAllow - optional (Default value : false)

Syntax : randomString(length, isCapitalAllow, isNumberAllow, isSpecialCharAllow)

var randomize = require("randomize-unique");

console.log(randomize.randomString());
//» wltvqprk

## `if you want 10 character random string than use like this:`

console.log(randomize.randomString(10));
//» rqmflwrusp

## `if you want capital letter in random string than use like this:`

console.log(randomize.randomString(8,true));
//» kYbQYlpoX

## `if you want capital letter and digit in random string than use like this:`

console.log(randomize.randomString(8, true, true));
//» 6YbQ9lpoX


## `if you want capital letter, digit and special character in random string than use like this:`

console.log(randomize.randomString(8, true, true, true));
//» 6Je*w#Lq

Random Array:

1 Parameters.

  1. length - optional (Default value : 10)

Syntax : randomArray(length)

var randomize = require("randomize-unique");

console.log(randomize.randomArray());
//» [1,44,56,32,87,71,41,69,51,70]

## `if you want 5 element in array than use like this:`

console.log(randomize.randomArray(5));
//» [1,44,56,32,87]

Random String Array:

4 Parameters.

  1. length - optional (Default value : 5)
  2. minStringLength - optional (Default value : 5)
  3. maxStringLength - optional (Default value : 10)
  4. isSpaceAllow - optional (Default value : true)

Syntax : randomStringArray(length, minStringLength, maxStringLength, isSpaceAllow)

var randomize = require("randomize-unique");

console.log(randomize.randomStringArray());
//» ['A Q','kMhg na','HRtmFGu','lc GWR',' O A ca']

## `if you want 3 element and string length is in between 10 to 20 in array than use like this:`

console.log(randomize.randomStringArray(3, 10, 20));
//» ['s EvprF lJx kE',' QsWuyjjcEDt e',' aVdAGjhveSbN']

Random or Unique Image Name:

2 Parameters.

  1. prefix - optional (Default value : "")
  2. suffix - optional (Default value : "")

Syntax : uniqueImageName(prefix, suffix)

var randomize = require("randomize-unique");

console.log(randomize.uniqueImageName());
//» 1591685161249

## `if you want prefix in image name than use like this:`

console.log(randomize.uniqueImageName("profile_"));
//» profile_1591685161249

## `if you want suffix in image name than use like this:`

console.log(randomize.uniqueImageName("","_img"));
//» 1591685161249_img

## `if you want prefix and suffix in image name than use like this:`

console.log(randomize.uniqueImageName("profile_","_img"));
//» profile_1591685161249_img

Random RGB Color:

Syntax : randomRGBColor()

var randomize = require("randomize-unique");

console.log(randomize.randomRGBColor());
//» rgb(255, 10, 34)

Random HEX Color:

Syntax : randomHEXColor()

var randomize = require("randomize-unique");

console.log(randomize.randomHEXColor());
//» #ff0000

Random HSL Color:

Syntax : randomHSLColor()

var randomize = require("randomize-unique");

console.log(randomize.randomHSLColor());
//» hsl(0, 100%, 50%)

Who contributed?

[ anil_bhadani99 ]