DiceForge
DiceForge is a Rust library for simulating dice rolls. It provides a simple and easy-to-use API for generating random dice rolls and calculating probabilities of different outcomes.
Features
Supports standard dice notation (e.g. 1d6, 2d10, etc.) Add, subtract, or even multiply modifiers to rolls
Installation
To use DiceForge in your Rust project, add the following to your Cargo.toml file:
[]
= "0.2.2"
Usage
To roll a standard six-sided die, you can use the roll function on a compiled Equation
object:
use Equation;
let die = new.unwrap;
let roll = die.roll.unwrap;
println!;
You can also add modifiers to your rolls:
use Equation;
let die = new.unwrap;
let roll = die.roll.unwrap;
println!;
It even takes order of operations into consideration so you could write an equation as complicated as
use Equation;
let die = new.unwrap;
let roll = die.roll.unwrap;
println!;
If you do not want to create an Equation
object you can directly roll the equation:
use roll;
let damage = roll.unwrap;
println!;
You can also roll with advantage or disadvantage:
use Equation;
let die = new.unwrap;
let mut roll = die.advantage.unwrap;
println!;
roll = die.disadvantage.unwrap;
println!;
You can check out the rest of the documentation at docs.rs
Contributing
Contributions are welcome! If you find a bug or want to add a new feature, please submit a pull request on GitHub.
or if you would like you can support me: