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

dice-probabilities

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

dice-probabilities

Calculate the probabilities of rolling less than p on n s-sided dice.

  • 1.0.0
  • latest
  • npm
  • Socket score

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

Dice Probabilities

Compute the probability of rolling p on n s-sided dice.

The formula for the probability comes from Wolfram; the multiplicative formula for the binomial coefficient comes from Wikipedia.

This page is just interesting: http://mathforum.org/library/drmath/view/52207.html

Installation

Usage

This module provides one function to compute the probability of rolling a specific number and another to roll dice.

const dice_prob = require('dice-probabilities');

// Probability for rolling 12 on 2 6-sided dice:
let p = dice_prop.P(12, 2, 6);

// Cumulative probability for rolling under 11 on 3 6-sided dice:
let cp = 0.0;
for (let i = 3; i <= 18; i++) {
  cp += dice_prop.P(i, 3, 6);
}

let r = dice_prop.roll(2, 6);

Keywords

FAQs

Package last updated on 13 Aug 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