Replace boost/random with stdlib random - #3412
Conversation
Jenkins Console Log Machine informationNo LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 20.04.3 LTS Release: 20.04 Codename: focalCPU: G++: Clang: |
Jenkins Console Log Machine informationNo LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 20.04.3 LTS Release: 20.04 Codename: focalCPU: G++: Clang: |
|
@andrjohns this has been failing on develop: https://jenkins.flatironinstitute.org/blue/organizations/jenkins/Stan%2FStan/detail/develop/419/pipeline it looks like maybe the std rngs aren’t really as cross-platform? |
Oh bizarre. I'll see if I can reproduce on mac and see where it's coming from |
|
@andrjohns since it's blocking downstream CI, thoughts on reverting while you explore? |
No objections from me! |
|
Ah, this is a wrinkle. Looks like there's no guarantee that the |
|
Classic C++ "standardization" |
|
I think we still have an option though. Boost's double factor = 1.0 / (double(rng.max() - rng.min()) + 1.0);
double result = 1;
while (result >= 1) {
result = double(rng() - rng.min()) * factor;
}Then we can use the |
Submission Checklist
./runTests.py src/test/unitmake cpplintSummary
Replaces all
boost/randomusages (distribution variate generators) with their stdlib<random>equivalents. This doesn't touch themixmaxRNG usage.A big side-effect here is that results will be slightly different for the same seed (several test values also updated because of this)
Intended Effect
Reduce Boost dependency footprint
How to Verify
Side Effects
Results for existing seeds will no longer match
Documentation
N/A
Copyright and Licensing
Please list the copyright holder for the work you are submitting (this will be you or your assignee, such as a university or company): Andrew Johnson
By submitting this pull request, the copyright holder is agreeing to license the submitted work under the following licenses: