Rng::gen_index; no usize for Standard#1471
Rng::gen_index; no usize for Standard#1471dhardy wants to merge 10 commits intorust-random:masterfrom
Conversation
|
I added
|
|
Do we still need |
|
It turns out that due to the bounds on
|
|
#1487 was merged instead |
CHANGELOG.mdentrySummary
Follows #1470, hence the first commit of this PR is "cfg-gate IndexVec::USize".
Motivation
Solve #1399 by removing support for sampling
usize,isizethrough the usual methods.Details
This is potentially the most drastic and problematic approach, but seems to work fine at least for
rand's tests. Specifically, it removes:Standarddistribution support forusize,isizeand non-zero and SIMD variantsUniformdistribution support for the same typesFill-ing[usize],[isize]Rng::gen_indexWeightedAliasIndexno longer supportsisizeorusizeweightsThis is meant for discussion. Potentially we could also use in a release with the option to add back support for the above types (this would be non-breaking).
fn Rng::gen_indexsupports various range types overusizeusing a private trait bound. Unorthodox and it's possible that the lack of ability for downstream crates to write generics over this would be an issue, but that is really not an intended feature. (We could also simplify this down to justRangeTo; that's all thatranduses anyway.)We might also want to expose
UniformUsize(used inrand::distr::slice), probably underrand::distr::uniform(alongsideUniformInt, possibly without implementingSampleUniformthough that is an option).