Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Rework the Random module #3402
The Random module currently has several problems:
That's why I decided to apply my previous experience with developing an RNG library to rework the Random module.
These changes make it possible to:
Now each RNG operation can consume multiple numbers from the underlying random number generator if needed, but of course everything is still deterministic. For implementation details see the comments in the code.
The interface stays almost the same (though I would like to suggest some changes in the future), but classes based on
@BlaXpirit I think we could use this PR as an example of what a PR should look like. The docs and comments in the code are extremely clear and useful, and the changes/addition are more than welcome. Even though you say you are an amateur in this subject you probably know more than most people, including me and I'd dare to say every other core committer.
I'd merge this right away, but I want to either double-check with @waj, or if someone else could review this and give a
While we're at it, why not add
Maybe people want less-secure UUIDs from a fast source, or maybe they want to use a secure random source with
Oct 15, 2016
1 check passed
@RX14 The problem with SecureRandom is that if you want several bytes then it's a single
@BlaXpirit I did it because individual commits didn't compile. The first commit used rand_type which wasn't defined there, I think it got introduced in the third commit.
In any case, I don't consider commit history that important, and the whole PR makes sense as a whole. And sorry, maybe I should have asked or pointed that out.