[][src]Trait weasel::entropy::EntropyRules

pub trait EntropyRules {
    type EntropySeed: Clone + Debug + Send + Serialize + for<'a> Deserialize<'a>;
    type EntropyModel;
    type EntropyOutput: PartialOrd + Copy + Num + Debug;
    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; }

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.

Associated Types

Loading content...

Required methods

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

Generates an EntropyModel starting from an EntropySeed.

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.

Loading content...

Implementors

impl<T> EntropyRules for UniformDistribution<T> where
    T: PartialOrd + Copy + Num + Debug + SampleUniform
[src]

type EntropySeed = u64

type EntropyModel = Lcg64Xsh32

type EntropyOutput = T

impl<T: PartialOrd + Copy + Num + Debug> EntropyRules for FixedAverage<T>[src]

type EntropySeed = ()

type EntropyModel = ()

type EntropyOutput = T

impl<T: PartialOrd + Copy + Num + Debug> EntropyRules for FixedLow<T>[src]

type EntropySeed = ()

type EntropyModel = ()

type EntropyOutput = T

fn generate(
    &self,
    _: &mut Self::EntropyModel,
    low: Self::EntropyOutput,
    _high: Self::EntropyOutput
) -> Self::EntropyOutput
[src]

Always returns low.

Loading content...