New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

simple-random-number-generator

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

simple-random-number-generator

random number generator js

  • 1.3.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
172
increased by18.62%
Maintainers
1
Weekly downloads
 
Created
Source

npm build with travis CI Conventional Commits


Simple Random Number Generator

install

npm install simple-random-number-generator

usage

const random = require("simple-random-number-generator");

default options

the exported function takes an option object with 3 arguments:

  • min : smallest possible value to return. defaults to 0
  • max : largest possible value to return. defaults to 1
  • integer : round the random number. Default: false

Examples

// use min and max parameter
const random = require("simple-random-number-generator");
let params = {
  min: 10,
  max: 100
};
random(params); // example outputs → 89.67405538799946
// use min, max and integer parameter
// set integer  to true to return whole number instead of float.
const random = require("simple-random-number-generator");
let params = {
  min: 5,
  max: 76,
  integer: true
};
random(params); // example outputs → 68
  • only use min parameter
let random = require("simple-random-number-generator");
let params = {
  min: 988
};
// if only provide min parameter, max number will be min + 1
random(params); // example output → 988.9231522653375
  • only use max parameter
let random = require("simple-random-number-generator");
let params = {
  max: 200
};
//if only provide max parameter, Min number will be max - 1
random(params); // example output → 199.28545186511627

Keywords

FAQs

Package last updated on 25 Feb 2023

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