This is an archive of the discontinued LLVM Phabricator instance.

Make RandomNumberGenerator compatible with <random>
ClosedPublic

Authored by serge-sans-paille on Oct 10 2016, 12:01 PM.

Details

Summary

As described in https://llvm.org/bugs/show_bug.cgi?id=25105 LLVM's RandomNumberGenerator is not compatible with the random distribution from <random>.

This microscopic patch updates the API accordingly.

Diff Detail

Repository
rL LLVM

Event Timeline

serge-sans-paille retitled this revision from to Make RandomNumberGenerator compatible with <random>.
serge-sans-paille updated this object.
serge-sans-paille added reviewers: jfb, mehdi_amini.
serge-sans-paille set the repository for this revision to rL LLVM.
mehdi_amini edited edge metadata.Oct 10 2016, 12:10 PM

Can you add a unittest for this? (That'd show that PR25105 is fixed)

include/llvm/Support/RandomNumberGenerator.h
41

Isn't this comment more on point if you place it before the using generator_type = std::mt19937_64; line above?

serge-sans-paille edited edge metadata.
serge-sans-paille removed rL LLVM as the repository for this revision.

New diff that takes into account Mehdi's comments.

A few unittest that test both C++11 compatibility and reproducibility.
More comment locality ;-)

mehdi_amini accepted this revision.Oct 11 2016, 12:14 AM
mehdi_amini edited edge metadata.

LGTM.

This revision is now accepted and ready to land.Oct 11 2016, 12:14 AM