Skip to content
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

Rewrite Rand functions #867

Merged
merged 2 commits into from Mar 29, 2018
Merged

Rewrite Rand functions #867

merged 2 commits into from Mar 29, 2018

Conversation

tiehuis
Copy link
Member

@tiehuis tiehuis commented Mar 29, 2018

We now use a generic Rand structure which abstracts the core functions
from the backing engine.

The old Mersenne Twister engine is removed and replaced instead with
three alternatives (Mersenne Twister isn't the best we could do):

These should provide sufficient coverage for most purposes. Consumers of the library that do not care about the actual engine implementation should use DefaultPrng and DefaultCsprng. (Might look further into Isaac64 as a CSPRNG actually since some literature possibly suggests otherwise on its applicability there, will revisit).

I've tried to keep the usage as simple as possible whilst ensuring you can't really use these incorrectly. I don't want to over abstract and end up with something like C++11 and it's random interface. Seed values are limited as a result to u64 and are extended as needed using a generator. This should be perfectly fine for and is recommended for Xoroshiro128+ and I've used the same technique for Pcg.

We now use a generic Rand structure which abstracts the core functions
from the backing engine.

The old Mersenne Twister engine is removed and replaced instead with
three alternatives:

 - Pcg32
 - Xoroshiro128+
 - Isaac64

These should provide sufficient coverage for most purposes, including a
CSPRNG using Isaac64. Consumers of the library that do not care about
the actual engine implementation should use DefaultPrng and DefaultCsprng.
@andrewrk andrewrk merged commit b80398b into master Mar 29, 2018
@andrewrk andrewrk deleted the rand-overhaul branch March 29, 2018 18:14
@andrewrk
Copy link
Member

brilliant

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants