Module bones_asset::bones_utils::prelude::prelude
Expand description
Convenience re-export of common traits, structs and utils.
Structs
- A Random Number generator, powered by the
WyRand
algorithm.
Enums
- Enum for determining the kind of PRNG, whether a fast one, or a slow, possibly crypographically secure one.
Traits
- Trait for enabling creating new
TurboCore
instances from an original instance. Similar to cloning, except forking modifies the state of the original instance in order to provide a new, random state for the forked instance. This allows for creating many randomised instances from a single seed in a deterministic manner. - This trait provides the means to easily generate all integer types, provided the main method underpinning this is implemented:
GenCore::gen
. Once implemented, the rest of the trait provides default implementations for generating all integer types, though it is not recommended to override these. - A marker trait to be applied to anything that implements
TurboCore
in order to indicate that a PRNG source is cryptographically secure, so being a CSPRNG. - Trait for implementing Seedable PRNGs, requiring that the PRNG implements
TurboCore
as a baseline. Seeds must beSized
in order to be used as the internal state of a PRNG. - Base trait for implementing a PRNG. Only one method must be implemented:
TurboCore::fill_bytes
, which provides the basis for any PRNG, to fill a buffer of bytes with random data. - Extension trait for automatically implementing all
TurboRand
methods, as long as the struct implementsTurboCore
&GenCore
. All methods are provided as default implementations that build on top ofTurboCore
andGenCore
, and thus are not recommended to be overridden, lest you potentially change the expected outcome of the methods.