
Product
Introducing Tier 1 Reachability: Precision CVE Triage for Enterprise Teams
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.
A simple and customizable npm package for rolling dice. With this package, you can roll standard six-sided dice, dice with a custom range of sides, and even multiple dice at once.
Install the package using npm:
npm install dices
Import the package into your project:
const dices = require("dices");
const result = dices.extract();
console.log(`You rolled a: ${result}`);
const result = dices.extractByRange(10); // Roll a 10-sided die
console.log(`You rolled a: ${result}`);
const results = dices.extractMany(3, 6); // Roll 3 six-sided dice
console.log(`You rolled: ${results.join(", ")}`);
const defaultResults = dices.extractMany(5); // Roll 5 six-sided dice by default
console.log(`You rolled: ${defaultResults.join(", ")}`);
extract()
Rolls a standard six-sided die.
Number
: A random number between 1 and 6.extractByRange(sides)
Rolls a die with a custom number of sides.
sides
(Number
): The number of sides on the die. Must be greater than 1.Number
: A random number between 1 and the specified number of sides.extractMany(count, sides)
Rolls multiple dice at once.
count
(Number
): The number of dice to roll. Must be greater than 0.sides
(Number
, optional): The number of sides on each die. Defaults to 6 if not provided.Array<Number>
: An array containing the results of each die rolled.const dices = require("dices");
// Roll a standard die
console.log(`Standard Roll: ${dices.extract()}`);
// Roll a custom 20-sided die
console.log(`Custom Roll: ${dices.extractByRange(20)}`);
// Roll 5 six-sided dice
console.log(`Multiple Rolls: ${dices.extractMany(5, 6).join(", ")}`);
// Roll 4 default six-sided dice
console.log(`Multiple Default Rolls: ${dices.extractMany(4).join(", ")}`);
This project is licensed under the MIT License. See the LICENSE file for details.
Contributions are welcome! Feel free to open an issue or submit a pull request.
Created by Carlo Leonardi.
FAQs
"A simple package to extract dices random"
We found that dices demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Product
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.
Research
/Security News
Ongoing npm supply chain attack spreads to DuckDB: multiple packages compromised with the same wallet-drainer malware.
Security News
The MCP Steering Committee has launched the official MCP Registry in preview, a central hub for discovering and publishing MCP servers.