I haven’t done a lot of work with rand
, but I do use it in the book. The “give me a random number” case ends up taking all this stuff:
extern crate rand;
use rand::Rng;
fn main() {
let secret_number = rand::thread_rng().gen_range(1, 101);
}
It’d be nice to have some kind of convenience function for “just do the right thing and give me some numbers in this range” rather than needing to use
a trait.