Skip to content
This repository has been archived by the owner on Dec 21, 2023. It is now read-only.

Update random number generator to use C++11 standard library #3344

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

hoytak
Copy link
Collaborator

@hoytak hoytak commented Oct 2, 2020

Currently, our random number generator uses boost random library, which has largely been supplanted by C++11. This PR updates the random number tools to use the C++11 intrinsics.

This change is needed to allow us to transition to C++17. In c++17, std::random_shuffle is removed in place of std::shuffle, which is no longer compatible with the boost random generators. This requires us to change the base random generators to the c++11 versions, and thus swap out the distributions to the c++11. After this PR, we no longer depend on boost random.

The c++11 versions allow us to simplify a couple of things:

  1. C++11 provides a true-random generator, which can replace our complicated, platform-specific version.
  2. C++11's mt19937_64 benchmarks as one of the fastest random number generators on modern hardware (e.g. https://gist.github.com/MikeLing/d258cf0c7e18d17639c577a695dbec41), so there is no point in having separate fast_ versions. This PR consolidates these. This change is in the second commit.

@hoytak hoytak requested review from ylow and znation October 2, 2020 19:58
@hoytak hoytak force-pushed the 20-10-update-random-number-generator branch from af22629 to 3481485 Compare October 2, 2020 19:58
@TobyRoseman
Copy link
Collaborator

@hoytak - will this change impact our users? Is there functionality where the same data and the same seed will now produce different results? If so, what functionality is affected?

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

Successfully merging this pull request may close these issues.

3 participants