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

get-random-in-range

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

get-random-in-range

Get a random number in range as a lazy curried function.

  • 1.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-50%
Maintainers
1
Weekly downloads
 
Created
Source

/**

  • get-random-in-range

  • Get a random integer in range via curried function that
  • makes it easy to apply defaults to your random number generators.
  • npm install get-random-in-range
  • or
  • yarn add get-random-in-range
  • Simple example:
  • randomInRange()()() // => immediately returns a number between 0 and 100
  • Use currying to apply defaults:
  • const randomGenerator = randomInRange(-100)(100);
  • // somewhere else
  • randomGenerator() // => returns a number between -100 and 100

*/

/** *

  • @param {number=} min
  • @return {function(number=): function(): number} */ var randomInRange = function randomInRange() { var min = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0; return function () { var max = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 100; return function () { return Math.floor(Math.random() * (max - min)) + min; }; }; };

module.exports = randomInRange;

Keywords

FAQs

Package last updated on 24 Jul 2018

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