Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upUpdate the random number generation page to use rand 0.6 #497
Comments
This comment has been minimized.
This comment has been minimized.
|
Slight correction: We also have e.g. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ivandardi commentedNov 14, 2018
The
randcrate just released its 0.6 release, so the cookbook should be updated accordingly, especially since the API got a big more ergonomic to use.Here's an update guide: https://rust-random.github.io/book/update-0.6.html
Here's an overview of how code with
randlooks like: https://rust-random.github.io/book/overview.htmlThe biggest benefit is the
random()function being able to generate values of any type with just importing the prelude, which is really useful. One note I'd like to say is that generating random booleans should be in the cookbook because that functionality is extremely common and most people useif rng.gen::<f64>() < 0.5which works but doesn't look as good as the recentif random()