src/random/README.md

third_party/random

What are these files?

They are copies of random and algorithm headers from the llvm standard library.

Motivation

Users complained about stability of random numbers across machines when setting seed across different platforms. See issue #379.

As pointed out by @jtibshirani:

the mersenne twister has the same implementation across platforms, the other random methods may differ from compiler to compiler

In PR #469, @halflearned included this reduced copy of the relevant headers, ensuring random number generation is done in a consistent way across compilers.

How to reproduce

File random.hpp

Extract only the relevant classes and functions from random.hpp:

From each class, remove all methods associated with operator<<.

Find and remove the following _LIBCPP macros: + _LIBCPP_BEGIN_NAMESPACE_STD + _LIBCPP_CONSTEXPR + _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK + _LIBCPP_END_NAMESPACE_STD + _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER + _LIBCPP_INLINE_VISIBILITY + _LIBCPP_MSVCRT + _LIBCPP_POP_MACROS + _LIBCPP_PUSH_MACROS + _LIBCPP_RANDOM + _LIBCPP_TEMPLATE_VIS + _LIBCPP_TYPE_VIS + _LIBCPP_USING_DEV_RANDOM

Find and replace prefix: + _VSTD:: -> std::

Add namespace nonstd.

File algorithm.hpp

Include modified random.hpp

Extract relevant class:

Replace prefix:

Add namespace nonstd.



Try the grf package in your browser

Any scripts or data that you put into this service are public.

grf documentation built on Oct. 1, 2023, 1:07 a.m.