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

bm-random

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bm-random

A collection of some useful functions that use random

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

#BM-Random

This module provides some useful functions that uses random. ##Installation

$ npm install bm-random

##API:

####fromArray

.fromArray(array: array<any>): any

Returns a random element of array or undefined if array is empty

####fromRange

.fromRange(min: number, max: number, step: number = 1): number
.fromRange(options: { min: number, max: number, step: number = 1 })

Preconditions:

  • max should be greater than or equal to min
  • step should be positive
  • the difference between max and min should be a multiple of step

Returns a random number in [min; max] whose distance from min is a multiple of step

####neutral

.neutral(n: number): number

Preconditions:

  • n should be a neutral number

Returns a neutral number that is lesser than n

Keywords

FAQs

Package last updated on 24 Jul 2015

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