Repository navigation
Tracker: planned changes for 0.5 #232
Copy link
Copy link
Closed
Labels
Description
To follow up on the release strategy in #205, here is a rough plan for Rand 0.5:
- Merge PRNG code improvements Cherry-pick changes to PRNG algorithms #209
- Add
Hc128RngAdd HC-128 #210 - Add new error types New error handling + type #225
- Add
SeedableRng::from_rngto replaceRandimpls on PRNGs; updateseedtype Port new SeedableRng trait #233 - Rename
IndependentSample→Distributionand removeSampleReplace distribution::Sample with Distribution + polymorphism over Rng #256 - Replace
RandwithUniformdistribution Replace distribution::Sample with Distribution + polymorphism over Rng #256 - Split
RngtoRng: RngCoreRngCore and extension trait Rng #265 - Move
Rngetc. to newrand-corecrate [requiresSampleRng;MoveAdd rand-core sub-crate and update version numbers #288]Rngto rand-core crate? #264 -
AddHalfOpen01distribution
Related issues which need solving:
- Naming of
try_fill_bytes: Renametry_fillorfill_bytes? dhardy/rand#27 - Name of "default" distribution:
Uniform; Distributions: Uniform, Uniform01, Open01, etc. dhardy/rand#81 - Distribution names: Distributions: Uniform, Uniform01, Open01, etc. dhardy/rand#81
- Fate of
Rand: Fate of theRandtrait dhardy/rand#83 - Re-exporting: Re-export
rand-coremembers inrand? dhardy/rand#15 - Decide which
Distribution::sampleprototype to use Distribution sample prototype and sized-ness ofRng#287 - Remove default implementations for
RngCoremethods?
There are some extra changes which should be relatively easy to add after the above:
- Add new floating-point sampling code Port new Range implementation and only have one uniform float distribution #274 (partial)
- Add new
Rangecode Port new Range implementation and only have one uniform float distribution #274 - Add
CryptoRng: RngCoreextension trait Small changes from experimental branch #273 - Switch
thread_rng()toHC-128? Replace ISAAC with HC-128 dhardy/rand#53 - Optional logging support: Log support dhardy/rand#39, Log feature: optional logging dhardy/rand#43
-
New iterator codeRng::iter #275 rejected; Deprecate gen_iter and add iteration examples #286 merged
Desired additions:
- Merge Add binomial and Poisson distributions #96 (requires testing/review)
- Add
Bernoullidistribution andgen_boolthen deprecategen_weighted_bool(see ReviseRngmethods #293)
Finally, a list of other planned changes, which probably won't make 0.5:
- Replace
gen_ascii_charswithAlphanumericdistribution: Add Alphanumeric distribution #279 - Revise character distributions (more classes, possible renaming): likely not desired
- Add
SeedableRng::from_hashable: Seeding PRNGs (traits and bit size) dhardy/rand#18, SeedableRng::Seed and from_hashable dhardy/rand#62 - Change the RNG used by
StdRng: Replace ISAAC with HC-128 dhardy/rand#53 - Change the RNG used by
weak_rng: Requirements for a small fast RNG dhardy/rand#60, Shootout: small, fast PRNGs dhardy/rand#52 - Publish one or more PRNG algorithm crates and remove
XorShiftRng,IsaacRng,ChaChaRng, etc. fromrand(don't export): To provide (or not) specific PRNGs? dhardy/rand#58 - Revise
WeightedChoice& sequences code: Sequence sampling:seq,WeightedChoicedhardy/rand#82 - Fork protection: WIPEONFORK [Linux] dhardy/rand#59
- Revise other Rng methods: gen_iter, gen_weighted_bool, gen_ascii_chars, choose, shuffle: Revise
Rngmethods #293, Deprecate gen_iter and add iteration examples #286, Add Alphanumeric distribution #279
Reactions are currently unavailable
Activity
pitdicker commentedon Jan 12, 2018
If we remove
reseedfromSeedableRngthis is going to break RNG implementations. Together with the introduction ofrand-core, I think it makes sense to drop theSizedrequirement.dhardy commentedon Jan 12, 2018
But the
Sizedthing only concernsRand, which really doesn't have much to do with theRngimplementations.dhardy commentedon Feb 24, 2018
Most of the above is implemented now.
There are still some changes to
Rangeand possibly also float sampling which I believe @pitdicker is working on; it would be nice to get those in the 0.5 release, and then there is therand-coresub-crate (#264), which could be done now or could wait until the next release (probably better now so that theimplsmodule can be exported only fromrand-core, as in my master branch).About the release process: I think the best method might be to publish a
0.5.0-pre.0pre-release, then wait a minimum of two weeks total for comment and testing (and at least 1 week since the last pre-release) during which no major new features will be merged.For
rand-coreI guess the version number should start at0.1.0-pre.0and be released on the same time-schedule; after this release I don't think there will be any need to synchronise versions/releases between the two crates (and hopefullyrand-corecan hit 1.0 sooner).Also during the release process we need to work out what kind of compatibility release to make for 0.4.
dhardy commentedon Feb 24, 2018
I just added two extra desired features:
CryptoRngand switching thread_rng to HC-128.Now would be a good time to add any extra requests for this release (but be warned that larger features may get delayed to 0.6 if not ready to merge soon).
pitdicker commentedon Feb 24, 2018
Yes, copying the
Rangecode with theRangeImpmethod from your branch was fairly easy (thanks to the huge merge you did 👍). I have used fixed-precision float methods as discussed in dhardy#85 (comment) forUniformandRange. The maximum precision methods will need a little more thinking, so I'll leave them for another PR. I think it is best to merge on top of #268, becauseMockAddRngmakes fixing the test fromWeightedChoiceeasier (usesRangeinternally).For switching
thread_rngto HC-128 I have things ready, waited on #252 before making the PR.Hopefully will finish things tomorrow.
pitdicker commentedon Mar 7, 2018
I think we are making pretty good progress towards 0.5 😄.
From #286 (comment)
I would still like to see it become available. I think it is settled that it should change from pure conversion functions to distributions, that can use arbitrary precision (not a fixed 32 or 64 bits). So I will basically have to rewrite things. We have to come up with names, and figure out how to expose a second kind of uniform floating point ranges.
That is why I left it out of #274. Shall we leave it until after rand 0.5?
Do you still want to do the
rand-coresplit?One thing I really want to see is
It should not be all that much work to polish the PCG and XoroshiroMT implementations in my
small_rngscrate, and also not to move all the PRNGs out to a separate crate.@dhardy, did you somehow get a notification from this?
dhardy commentedon Mar 7, 2018
Perhaps; I don't think we should block 0.5 waiting on it at least.
I asked, and the answer seems to be yes. This is easy to implement but I thought better to wait until most other stuff is done though; I may get to this soon now. (There's additional motivation: we can make the
implsmodule available only throughrand-core.)I'm not sure about changing
weak_rngthough it definitely makes sense. Did we decide which RNG to use yet? Ultimately it would be nice for this to be in a separate crate though it could be inrandfor the next release; on the other hand it should be easy to add another crate oncerand-coreis ready anyway.No, I missed the notification on your history article; I'll have a read.
pitdicker commentedon Mar 7, 2018
The choice was between PCG and my Xoroshiro variant. But to be honest I found a problem with the last one, trying to prove it was correct (a while ago actually). A widening multiply does not guarantee uniformity or equidistribution. It should be a 'real', 128 bit multiply. This can be done by using a widening multiply plus a normal multiply, causing a little slowdown (but still faster than PCG). Just to err on the safe side I would make PCG the default, and also because it is better known.
dhardy commentedon Mar 7, 2018
That sounds good enough to me; I'd rather err on the side of strong than fast-and-weak personally. But you should probably make a post in dhardy#60 to clarify to the people who commented there what the plan is. Also I think perhaps we should remove
weak_rngand instead add aSmallRngwrapper and make users doSmallRng::new(). (We could addFastRngtoo and make the latter use Xoroshiro*, potentially.)vks commentedon Mar 7, 2018
I think removing
weak_rngis a good idea. I'm not sure about theSmallRngname. Why not just use the name of the RNG? Reproducibility is important, I think changing the implementation ofSmallRngshould be considered a breaking change. I would rather use the name of the algorithm and recommend RNGs for different purposes in the documentation instead of abstracting them away.In my opinion, the following kinds of generators should be considered:
u64. (E.g. splitmix64)The tradeoffs between 1., 2. and 3. should be clearly documented.
(Personally, I think 2. and 5. are extremely niche. 4. could be hidden behind some abstraction or replaced with 1. I don't see a convincing reason to use xoroshiro128* over xoroshiro128+.)
dhardy commentedon Mar 8, 2018
@vks please see dhardy#58. The intention is to provide both names (e.g.
StdRngandHc128Rng), but put the former inrandand the latter in other crates, and to clearly mark the ones inrandas non-reproducible."Practically almost everyone" doesn't fly as an argument; there are still many people using MT19937, and while it might be sufficient for their purposes I won't recommend it just because it's popular.
vks commentedon Mar 8, 2018
Thanks for the link!
In my opinion the argument has some merit, because given the widespread use of generators with linear dependencies, I would expect to hear of practical problems if there were any. Following the same line of thought, I think the statistical quality of MT is ok, the performance seems like a bigger issue in practice.
dhardy commentedon Mar 8, 2018
@vks I opened #289 regarding your point about dropping
weak_rng. Also note:randtemporarily may be possibleclarfonthey commentedon Mar 8, 2018
I'm kind of leaning toward not having any
genmethods onRngat all and instead making these part ofDistributionitself. Also, giving preferential treatment toUniformmay lead to a lot of people using it when they shouldn't, e.g. via habits from other languages, likerng.gen() % ninstead of using a proper range.25 remaining items
pitdicker commentedon Apr 2, 2018
I have to admit doing a pre-release was useful! Especially thanks to the announcement on Reddit.
It seems to me we are mostly there taking care of the feedback after the pre-release. At least the part I care about 😄.
For #359 I have a branch ready. Do we want to try something with #348 now? And maybe hide the
ChaChaRng::set_roundsmethod #349?dhardy commentedon Apr 2, 2018
I have some extra docs in progress. Sorry, I've not been able to devote much time to Rand the last week (and I won't be able to next week either; might get a little time this week though).
pitdicker commentedon Apr 2, 2018
We are just volunteers, right?
pitdicker commentedon Apr 4, 2018
Found something nice in the
cargo.tomlthat gets shipped on crates.io:So we don't need to change the
rand_coredependency line incargo.tomlto point to the crates.io version, we can just depend on the one in the workspace.dhardy commentedon Apr 5, 2018
We at least need a version number for the dependency; it complained about that last time.
dhardy commentedon Apr 17, 2018
rand_core 0.1.0 has been released.
dhardy commentedon Apr 27, 2018
I'd like to get the following done, then I think we're good for a release:
BlockRngCore::Resultsalso beAsMut? #376 ? I'd forgotten about this; might make sense to solve nowNot sure about these:
BlockRngCore::Itemtype? #305We could also look at these, but there's no reason they can't wait IMO:
Rng::genon arrays? #269OsRng#332thread_rngtoThreadRng::new()? #404dhardy commentedon May 18, 2018
I posted new pre-releases 3 days ago:
So far there has been little feedback regarding stuff that needs changing, so it looks likely that these will be the final pre-releases. In this case the releases should be made early next week.
pitdicker commentedon May 21, 2018
Can you make a PR with the final changes for the release, instead of a direct push (then I can be a second pair of eyes...)?
dhardy commentedon May 21, 2018
Looks to me like all the main things are in place for the 0.2 / 0.5 releases. So do you want to make the PR and I'll release?
dhardy commentedon May 21, 2018
Done:
pitdicker commentedon May 21, 2018
🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉
dhardy commentedon May 22, 2018
Yes, I know! 🎉 🍰 ⛵