-
Notifications
You must be signed in to change notification settings - Fork 2
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
Distributions: Uniform, Uniform01, Open01, etc. #81
Comments
🎉. Also, thanks for opening this issue for a fresh look and discussion. Anyone we should cc? In rust-lang/rfcs#2106 (comment) I suggested that Dropping For the uniform distributions of floats we now have:
I don't think the names are perfect. For the Personally I am not sure if we need both the There is an other not-all-that-meaningful difference between I think renaming |
Removing the I don't really understand the consequences around dynamic dispatch. I should just try it and see what brakes, but would you be willing to explain it? |
In #72 (comment) I made a list of changes / extra tests we may want to add to the distributions, besides something like an external test suite. There is not really anything in there that should happen before the merge into upstream though. Something I would really like to see is to have the floating point range implementation be exact, and not sometimes crossing the boundaries. Now it is a bit strange that we can say: the precision of the results of |
Dynamic dispatch: lots of OO languages use a vtable at the beginning of an object, for example an Java object of the |
The last few commits re-implement some types as distributions to let me switch them. This still needs Why do it now? Changing |
I'm not looking at changing the algorithms now, just the infrastructure. I might let you make the algorithms PRs ;-) Hmm, Removing |
@pitdicker maybe I can annoy you even more by putting implementations in At least, the compiler doesn't complain, though my text editor highlights both |
Thanks for the explanation around
Ok, it is high time I start working on upstream 😄.
Just two weeks ago I was thinking something like that would be nice, but more with the range code in mind. Could the |
I hadn't thought about moving the range code, but I guess that could work, if there's not too much to it. The distributions top-level module currently has |
I believe we settled this, though we now use |
Update: we will likely use these distributions:
Uniform
for the default distribution, replacingRand
(including ints, floats with range[0, 1)
, etc.)Original post follows.
I'm looking at bringing over some of the changes to distributions code to upstream, in particular replacing
Sample
andIndependentSample
withDistribution
, but the change-set touches on a few other things (adjustments to things likeExp1
are needed to support dynamic dispatch (Rng+?Sized
) inDistribution::sample
, sinceRand
doesn't support this and changing that would break allRand
implementations everywhere).So, question: is everyone happy with the distribution names we converged on in this branch, that is
Uniform
for integers,Uniform01
andOpen01
etc. for floats,Default
for "a sensible distribution for any type"?This is of course redundant; we could drop
Uniform
andUniform01
in favour of usingDefault
directly. Possibly there is a better name thanDefault
(but please notRand
)!Wacky ideas:
Uniform
→Full
orFullRange
Uniform01
→HalfOpen01
Of course we don't need any changes. Just asking since it didn't always appear people were happy with these names.
The text was updated successfully, but these errors were encountered: