Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow creation of random
Rotation2d
(#13684)
# Objective Fill the gap in this functionality by implementing it for `Rotation2d`. We have this already for `Quat` in addition to the direction types. ## Solution `bevy_math::sampling` now contains an implementation of `Distribution<Rotation2d>` for `Standard`, along with the associated convenience implementation `Rotation2d: FromRng`, which allows syntax like this for creating a random rotation: ```rust // With `FromRng`: let rotation = Rotation2d::from_rng(rng); // With `rand::random`: let another_rotation: Rotation2d = random(); // With `Rng::gen`: let yet_another_rotation: Rotation2d = rng.gen(); ``` I also cleaned up the documentation a little bit, seeding the `Rng`s instead of building them from entropy, along with adding a handful of inline directives.
- Loading branch information