Struct urandom::distributions::Dice

source ·
pub struct Dice(_);
Expand description

Standard uniform dice.

Examples

use urandom::distributions::Dice;
let mut rng = urandom::new();

let sum: i32 = rng.samples(Dice::D6).take(2).sum();
assert!(sum >= 1 && sum <= 12);

Implementations

Constructs an N-sided dice.

4-sided dice.

The Caltrop, always lands with the point face up. This dice is numbered 1-4.

6-sided dice.

Is the standard cube-shaped dice, not only used in D&D, but different card and dice game as well.

8-sided dice.

Is the eight-sided dice which used heavily for different strategies, at different points of gameplay.

10-sided dice.

Used heavily, and a combination of two dice can result in moves 1 - 100.

20-sided dice.

The signature dice of the dungeons and dragons game is the twenty sided dice. Is used most often in the game, and is the dice which is going to determine all of the strategies and attacks which will be used during game play by players. Also used to determine saving rolls during game play.

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Generate a random value of T, using rng as the source of randomness.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.