Repository navigation
Conversation
|
Test failure looks like a tool problem here too. |
|
I should also mention that both of these functions have very little usage right now. In fact, I'll remove the deprecation "wrapper" for |
…Rng::with_ratio. Also rename Bernoulli::from_ratio to Bernoulli::with_ratio.
|
This also renames |
|
I restarted that test but it might fail again. 🤷♂️ To be honest I'm not keen on your names either. They're long and also feel awkward (it's not "rand with ...", it's "rng with ..."). |
|
I asked about the build failure: koute/cargo-web#116 |
|
The "with probability" felt descriptive given that you enter the if-branch with a given probability. So reading the code it feels a lot more clear what's going on. But I agree that a shorter name would be nice if it can be kept descriptive. |
|
In my opinion the I can understand the idea behind |
|
Ok |
The
gen_boolandgen_ratiofunctions will most commonly be used in situations likeHowever the name of that those functions feel awkward when used in this scenario. Not only is the "gen" part redundant, since that's what rng objects generally do (and what the "g" in "rng" stands for). But the fact that we're branching on a boolean value doesn't actually say anything about how that boolean is created.
Likewise
gen_ratiodoesn't actually generate a ratio, it generates a boolean with a probability expressed as a ratio.This PR renames
gen_boolandgen_ratiotowith_probabilityandwith_ratio. So code instead reads as:and
The old names are kept for now, but with a deprecation warning.