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

Import xoshiro crate #642

Merged
merged 9 commits into from Dec 21, 2018

Conversation

Projects
None yet
2 participants
@vks
Collaborator

vks commented Nov 14, 2018

This is based on the xoshiro crate with minimal modifications.

vks added some commits Nov 14, 2018

Add xoshiro benchmarks
* This replaces the old xoshiro benchmarks.
* rand_xoshiro now uses the correct version of rand_core.

@vks vks requested a review from dhardy Nov 14, 2018

@vks vks referenced this pull request Nov 14, 2018

Merged

Mention xoshiro256** #5

vks added some commits Nov 14, 2018

@dhardy

This comment has been minimized.

Member

dhardy commented Nov 14, 2018

Thanks. Might take me a couple of days to review.

We can update the doc and publish rand_xoshiro without a new rand release anyway.

@vks

This comment has been minimized.

Collaborator

vks commented Nov 14, 2018

Yeah, this is not urgent.

@dhardy

A couple of annoying little points here...

but other than the API doc I see no real reason this should be in the same repo. Maybe we should revive small-rngs or make a new rngs? The same is true for rand_xorshift, _isaac and _chacha once the deprecated re-exports are removed.

The advantages are faster/simpler CI, less stuff in this repo, and a separate issue tracker. I think it would be worth it. Shall I import your existing repo, move the code to a sub-directory, and publish as rust-random/rngs?

@@ -71,6 +71,7 @@ matrix:
- cargo test --manifest-path rand_isaac/Cargo.toml --features=serde1
# TODO: cannot test rand_pcg due to explicit dependency on i128
- cargo test --manifest-path rand_xorshift/Cargo.toml --features=serde1
- cargo test --manifest-path rand_xoshiro/Cargo.toml

This comment has been minimized.

@dhardy

dhardy Nov 20, 2018

Member

👍 but you should also add to utils/ci/script.sh and appveyor.yml. Yeah, it's a pain to have to configure CI in three places 😦

This comment has been minimized.

@vks

vks Nov 21, 2018

Collaborator

Will do. Maybe we should automatically generate the scripts from from some declaration of crates.

This comment has been minimized.

@dhardy

dhardy Nov 21, 2018

Member

Maybe, though not all the scripts are identical (for annoying reasons). Not something I want to spend time solving.

@@ -30,6 +31,7 @@ use rand_chacha::ChaChaRng;
use rand_hc::{Hc128Rng, Hc128Core};
use rand_pcg::{Lcg64Xsh32, Mcg128Xsl64};
use rand_xorshift::XorShiftRng;
use rand_xoshiro::Xoshiro256StarStar;

This comment has been minimized.

@dhardy

dhardy Nov 20, 2018

Member

I'd like all variants represented in the benchmarks... which does bring up the question of whether we should have them here.

This comment has been minimized.

@vks

vks Nov 21, 2018

Collaborator

I think it is nice to compare the performance of all the generators in one place. This also reduces code duplication.

I'll add the other variants.

[package]
name = "rand_xoshiro"
version = "0.1.0" # NB: When modifying, also modify html_root_url in lib.rs
authors = ["Vinzent Steinberg <Vinzent.Steinberg@gmail.com>"]

This comment has been minimized.

@dhardy

dhardy Nov 20, 2018

Member

If you want to include this in the main repo, then I'd prefer the same convention as the other crates (though you can include yourself in addition if you like).

This comment has been minimized.

@vks

vks Nov 21, 2018

Collaborator

Sure, no problem.

Show resolved Hide resolved rand_xoshiro/LICENSE-MIT Outdated
@vks

This comment has been minimized.

Collaborator

vks commented Nov 21, 2018

Maybe we should revive small-rngs or make a new rngs?

Didn't we decide against that because of problems with the docs? I don't see how that changed. I don't really care in which repository this lives, but I would prefer the links in the docs to work.

@dhardy

This comment has been minimized.

Member

dhardy commented Nov 21, 2018

Part for that reason, part because it was difficult having direct dependencies of rand in a different repo, when those dependencies require rand_core from this repo. Ok, it can stay here for now.

Show resolved Hide resolved rand_xoshiro/src/splitmix64.rs Outdated
// David Stafford's
// (http://zimbry.blogspot.com/2011/09/better-bit-mixing-improving-on.html)
// "Mix4" variant of the 64-bit finalizer in Austin Appleby's
// MurmurHash3 algorithm.

This comment has been minimized.

@dhardy

dhardy Dec 14, 2018

Member

Can you explain what the link is? This algorithm is SplitMix. Isn't the point of this implementation to reproduce output from the official version?

This comment has been minimized.

@vks

vks Dec 17, 2018

Collaborator

AFAIK, the official version only supports generating u64 natively. This is a more efficient variant for generating u32.

@dhardy

Sorry for poor time estimate; apparently "a couple of days" can mean a month!

Looks good, but there are a lot of RNGs included. I specifically kept rand_pcg small because not many will be widely used and it keeps the dependencies of rand small.

@vks

This comment has been minimized.

Collaborator

vks commented Dec 17, 2018

AFAIK, this is likely not going to be a dependency of rand, so I implemented all the RNGs from the reference implementation. Which RNGs would you drop?

@dhardy

This comment has been minimized.

Member

dhardy commented Dec 20, 2018

I guess there are no obvious candidates to drop. Apparently no-one else is opinionated on this, so lets just accept this as-is for now — although I am of the opinion that we should move this to another repository later (along with all other PRNGs not directly depended on by rand).

I'll leave this until tomorrow for any final comments.

@dhardy dhardy merged commit 5a67e32 into rust-random:master Dec 21, 2018

2 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment