anydice
    TypeScript icon, indicating that this package has built-in type declarations

    1.1.0 • Public • Published

    anydice.js

    npm

    Note: AnyDice is not particularly fast; results can take a second or two to come back

    API

    Simple

    const { roll } = require("anydice");
    // import { roll } from "anydice";
     
    // later...
     
    console.log(await roll("output [highest 1 of 2d20]+10"));

    Advanced

    const { AnyDice } = require("anydice");
     
    // later...
     
    const input = `output [highest 1 of 2d20]+10
    output 3d6 named "result 2"`;
     
    const result = await AnyDice.run(input);
    const rolls = result.roll(result.first(), 10); // [highest 1 of 2d20]+10
    const possibleValues = result.possibleValues("result 2"); // 3d6
    console.log(rolls);
    console.log(possibleValues);

    Install

    npm i anydice

    DownloadsWeekly Downloads

    0

    Version

    1.1.0

    License

    MIT

    Unpacked Size

    18.4 kB

    Total Files

    15

    Last publish

    Collaborators

    • dlom