npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

niv_dice_roller

v0.2.8

Published

This library provides a simple and efficient way to simulate dice rolls directly from your JavaScript applications using WebAssembly. With it, you can roll any number of dice, each with a customizable number of sides. Built with Rust, this library can pro

Downloads

14

Readme

Dice Roller RUST

This library provides a simple and efficient way to simulate dice rolls directly from your JavaScript applications using WebAssembly. With it, you can roll any number of dice, each with a customizable number of sides. Built with Rust, this library can process up to 10 million dice rolls in under 6 seconds, showcasing the power of WebAssembly in high-performance applications.

Features

  • Roll any number of dice with any number of sides.
  • Unmatched Performance: Capable of rolling up to 10 million dices in less than 6 seconds.
  • Fast and efficient computation with Rust and WebAssembly.
  • Easy integration into JavaScript projects.

Getting Started

To use this library, you'll first need to include it in your project. Assuming you have a package generated and published, you can include it via npm or yarn:

npm install niv_dice_roller
# or
yarn add niv_dice_roller

Usage

Here's a quick example to get you started:

import { roll_dice } from 'your-dice-roller-package';

const diceConfig = [
  {times: 4, side: 20},
  {times: 2, side: 6},
  {times: 3, side: 10}
];
// This will roll 4d20, 2d6, and 3d10 dices, returning an object with the roll results.

const output = roll_dice(diceConfig);

console.log(output);

This will roll 4d20, 2d6, and 3d10 dice, returning an object with the roll results.

Example of Output

The roll_dice function returns an object where each key corresponds to a dice configuration from the input array, and its value is an array of roll results. Here’s an example output for the provided input:

{
  "1": [1, 6, 4, 19],
  "2": [1, 4],
  "3": [6, 5, 2]
}