[][src]Function destiny::possible_rolls

pub fn possible_rolls(string: &str) -> Vec<i64>

Calculates all the possible roll combinations for a given dice string.

Examples

Calculate the possibilities of rolling 1d6:

use destiny::possible_rolls;

let rolls = possible_rolls("1d6");
assert_eq!(vec![1, 2, 3, 4, 5, 6], rolls);

Calulate the possible rolls of 1d4 + 2:

use destiny::possible_rolls;

let rolls = possible_rolls("1d4 + 2");
assert_eq!(vec![3, 4, 5, 6], rolls);

Calculating the possibilities of 2d4:

use destiny::possible_rolls;

let rolls = possible_rolls("2d4");
assert_eq!(vec![2, 3, 4, 5, 3, 4, 5, 6, 4, 5, 6, 7, 5, 6, 7, 8], rolls);