[−][src]Trait weasel::entropy::EntropyRules
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
type EntropySeed: Clone + Debug + Send + Serialize + for<'a> Deserialize<'a>
See EntropySeed.
type EntropyModel
See EntropyModel.
type EntropyOutput: PartialOrd + Copy + Num + Debug
See EntropyOutput.
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
&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
impl<T> EntropyRules for UniformDistribution<T> where
T: PartialOrd + Copy + Num + Debug + SampleUniform,
[src]
T: PartialOrd + Copy + Num + Debug + SampleUniform,
type EntropySeed = u64
type EntropyModel = Lcg64Xsh32
type EntropyOutput = T
fn generate_model(&self, seed: &Option<Self::EntropySeed>) -> Self::EntropyModel
[src]
fn generate(
&self,
model: &mut Self::EntropyModel,
low: Self::EntropyOutput,
high: Self::EntropyOutput
) -> Self::EntropyOutput
[src]
&self,
model: &mut Self::EntropyModel,
low: Self::EntropyOutput,
high: Self::EntropyOutput
) -> Self::EntropyOutput
impl<T: PartialOrd + Copy + Num + Debug> EntropyRules for FixedAverage<T>
[src]
type EntropySeed = ()
type EntropyModel = ()
type EntropyOutput = T
fn generate_model(
&self,
_seed: &Option<Self::EntropySeed>
) -> Self::EntropyModel
[src]
&self,
_seed: &Option<Self::EntropySeed>
) -> Self::EntropyModel
fn generate(
&self,
_: &mut Self::EntropyModel,
low: Self::EntropyOutput,
high: Self::EntropyOutput
) -> T
[src]
&self,
_: &mut Self::EntropyModel,
low: Self::EntropyOutput,
high: Self::EntropyOutput
) -> T
impl<T: PartialOrd + Copy + Num + Debug> EntropyRules for FixedLow<T>
[src]
type EntropySeed = ()
type EntropyModel = ()
type EntropyOutput = T
fn generate_model(
&self,
_seed: &Option<Self::EntropySeed>
) -> Self::EntropyModel
[src]
&self,
_seed: &Option<Self::EntropySeed>
) -> Self::EntropyModel
fn generate(
&self,
_: &mut Self::EntropyModel,
low: Self::EntropyOutput,
_high: Self::EntropyOutput
) -> Self::EntropyOutput
[src]
&self,
_: &mut Self::EntropyModel,
low: Self::EntropyOutput,
_high: Self::EntropyOutput
) -> Self::EntropyOutput
Always returns low
.