Socket
Book a DemoInstallSign in
Socket

define-probability

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

define-probability

Define probability of getting results

latest
Source
npmnpm
Version
0.0.1
Version published
Maintainers
1
Created
Source

define-probability Build Status

Define probability of getting results

Feel free to contribute and improve this lib.

Install

$ npm install --save define-probability

Usage

const defineProbability = require('define-probability')

const probabilities = [
  { value: 'male', prob: .2 },
  { value: 'female', prob: .8 }
]

defineProbability(probabilities)
// => female

API

defineProbability(entry)

returns value.

entry

Type: array
Required

Array must have at least 2 entries and must have value and prob keys.
Where value is the value returned and prob the probabilities of getting this result. value is a number between 0 and 1.

License

MIT © Bu Kinoshita

Keywords

probability

FAQs

Package last updated on 30 Jun 2017

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