Trait EntropyRules

Source
pub trait EntropyRules {
    type EntropySeed: Clone + Debug + Send + Serialize + for<'a> Deserialize<'a>;
    type EntropyModel;
    type EntropyOutput: PartialOrd + Copy + Num + Debug;

    // Required methods
    fn generate_model(
        &self,
        seed: &Option<Self::EntropySeed>,
    ) -> Self::EntropyModel;
    fn generate(
        &self,
        model: &mut Self::EntropyModel,
        low: Self::EntropyOutput,
        high: Self::EntropyOutput,
    ) -> Self::EntropyOutput;
}
Expand description

Defines how casuality works inside the battle system.

Entropy must be deterministic. If you use a generator, make sure that by starting from an identical seed the same sequence of random bits will be reproduced.

Required Associated Types§

Required Methods§

Source

fn generate_model(&self, seed: &Option<Self::EntropySeed>) -> Self::EntropyModel

Generates an EntropyModel starting from an EntropySeed.

Source

fn generate( &self, model: &mut Self::EntropyModel, low: Self::EntropyOutput, high: Self::EntropyOutput, ) -> Self::EntropyOutput

Generates a random value within a half-open range [low, high).

high is guaranteed to be greater or equal to low.

Implementors§