[](https://crates.io/crates/bevy_simple_random)
[](https://codeberg.org/pragma-twice/bevy_simple_random)
[](https://docs.rs/bevy_simple_random)
# Bevy Simple Random
> [!NOTE]
> I kindly request that, while welcome, forks are kept in free forges such as Codeberg. Though it is not within my control, I do not wish for my projects to be hosted on GitHub. For more info, see: [Give Up GitHub!](https://giveupgithub.org)
Bevy simple random is crate for using random number generators in with WASM support.
To use, simply initialize a global rng resource:
```rust
app.insert_resource(ChaChaGlobalRng::from_time());
```
then you can use it access it from a system as a resource:
```rust
fn system(mut rng: ResMut<ChaChaGlobalRng>)
```
Alternatively you can attach your rng to an entity:
```rust
app.spawn(ChaChaEntityRng::from_time());
```
then you can use it access it from a system as a component:
```rust
fn system(rng: Query<&mut ChaChaEntityRng>)
```
## Contributing to Bevy Simple Random
This project has a strict "no LLMs" policy. Do not even use LLMs for analysing/examining the code. Also, please abide by the [Code of Conduct](./CODE_OF_CONDUCT.md) when interacting and contributing to this project.
## License
Licensed under either of
- Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or <http://www.apache.org/licenses/LICENSE-2.0>)
- MIT license ([LICENSE-MIT](LICENSE-MIT) or <http://opensource.org/licenses/MIT>)
at your option.