Crates.io | rantz_random |
lib.rs | rantz_random |
version | 1.2.1 |
source | src |
created_at | 2024-05-28 21:04:29.016547 |
updated_at | 2024-07-20 20:54:23.369286 |
description | Mostly just a wrapper around fastrand for a bunch of types. Supports bevy and rantz_spatial2d. |
homepage | https://github.com/BobG1983/rantz_suite |
repository | https://github.com/BobG1983/rantz_suite |
max_upload_size | |
id | 1254850 |
size | 35,398 |
rantz_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:
bevy
feature)bevy
feature)Position2D
, and all the compasses (with the spatial2d
feature) - Requires rantz_spatial2d
Can generate random values in a range for:
bevy
feature)Position2D
(with the spatial2d
feature) - Requires rantz_spatial2d
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.
Add to your Cargo.toml
. Use rantz_random::*;
to get access to the traits that define random generation.
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 gaurenteed determinism, any system that uses the features of this crate will need to be .chain()
ed together when added to a Bevy app.