Add .choices() method to the Slice distribution#1402
Add .choices() method to the Slice distribution#1402dhardy merged 6 commits intorust-random:masterfrom
Conversation
Signed-off-by: Justus Fluegel <justusfluegel@gmail.com>
Signed-off-by: Justus Fluegel <justusfluegel@gmail.com>
|
I am not quite sure if that changelog format I am using here is correct so I would appreciate someone looking over that and giving me a short reply :) |
a609bd4 to
b6b8b5a
Compare
Signed-off-by: Justus Fluegel <justusfluegel@gmail.com>
|
Sorry I kinda messed up my commits here, wanted to keep a clean history so force-pushed to my branch ( shouldn't really matter on your end either way ) |
|
No worries about commit history; we squash in this repo. (Personally I still force-push often enough.) |
…call time Signed-off-by: Justus Fluegel <justusfluegel@gmail.com>
Signed-off-by: Justus Fluegel <justusfluegel@gmail.com>
Signed-off-by: Justus Fluegel <justusfluegel@gmail.com>
dhardy
left a comment
There was a problem hiding this comment.
A little unorthodox, but seems fine to me. 👍
|
CI failure is a false positive from the new |
yep I figured :) |
|
Is there some information on the release cycle of rand somewhere ( Is there a date when this will be in alpha / stable )? Don't want to push you to release something, just some information on when I should check back here would be nice :) |
|
There's a tracking issue for 0.9. We're a little slow making releases, but I'll push out a second alpha soon. |
|
thanks 👍 |
CHANGELOG.mdentrySummary
Add a
.choices() -> NonZeroUsizemethod to the slices distributionMotivation
In one of my projects we use a Slice Distribution for the input of a constructor for a type which needs to generate some element of that slice & at the same time a boolean for another variable with the same probability of each element in the Distribution occurring. A simple
1 / distr.choices()would help us a lot in that regards.Details
Adds the
Slices::choices() - NonZeroUsizemethod, which returns the count of different choices in the input vector (counting duplicates in that vector as well)