reactor_random 1.0.0

Mostly just a wrapper around fastrand for a bunch of types. Supports bevy and reactor_spatial2d.
Documentation
  • Coverage
  • 100%
    23 out of 23 items documented1 out of 2 items with examples
  • Size
  • Source code size: 141.29 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 5.84 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 3m 12s Average build duration of successful builds.
  • all releases: 3m 12s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • Repository
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • BobG1983

reactor_random

A simple Rust library for generating random values using fastrand. Basically just a fastrand wrapper for a few additional types at the moment. Likely to grow over time. Designed for use with Bevy.

Can generate random values for:

  • i8-128
  • u8-128
  • f32 & f64
  • Vec2/3/4, UVec2/3/4, and IVec2/3/4 (with the bevy feature)
  • Color (with the bevy feature)
  • Degrees, Radians, Position2D, and all the compasses

Can generate random values in a range for:

  • i8-128
  • u8-128
  • f32 & f64
  • Vec2/3/4, UVec2/3/4, and IVec2/3/4 (with the bevy feature)
  • Degrees, Radians, and Position2D

Can shuffle anything Clone + IntoIterator<T> + FromIterator<T> as well as returning a random element, or random index.

Also includes a WeightedTable class for use in weighted random generation.

Usage

Add to your Cargo.toml. Use reactor_random::*; to get access to the traits that define random generation.

Determinism

This crate relies on fastrand which is "deterministic". That is to say, for a given seed value, assuming system order is deterministic, the results will be deterministic.

For guaranteed determinism, any system that uses the features of this crate will need to be .chain()ed together when added to a Bevy app.