-
-
Notifications
You must be signed in to change notification settings - Fork 483
Rng::gen_index; no usize for Standard #1471
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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).