rust-random / rand

A Rust library for random number generation.
https://crates.io/crates/rand
Other
1.67k stars 432 forks source link

gen_ratio -> random_probability, gen_bool -> random_probability_f64 #1527

Open oconnor663 opened 1 week ago

oconnor663 commented 1 week ago

I'm not sure I actually love these names, but I wanted to continue the discussion that @dhardy and @newpavlov were having in https://github.com/rust-random/rand/pull/1488. What do you guys think of this option?

dhardy commented 1 week ago

I don't much like this — too long, _f64 is too specific.

@newpavlov's suggestion to use some trait like IntoProbability supporting f64 and (u32, u32) might be more accepatble; I'm not certain.

oconnor663 commented 1 week ago

Yeah that's fair. There's some precedent in the standard library, but maybe it doesn't feel great there either.