.. _file_include_cmb_random.h: File cmb_random.h ================= |exhale_lsh| :ref:`Parent directory ` (``include``) .. |exhale_lsh| unicode:: U+021B0 .. UPWARDS ARROW WITH TIP LEFTWARDS Fast, high-quality pseudo-random number generators and distributions built from the ground up for multithreaded use. .. contents:: Contents :local: :backlinks: none Definition (``include/cmb_random.h``) ------------------------------------- .. toctree:: :maxdepth: 1 program_listing_file_include_cmb_random.h.rst Detailed Description -------------------- The main generator gives 64-bit pseudo-random numbers with 256 bits of state and a cycle of at least 2^64 samples. It is seeded by a 64-bit value but amplifies that to a 256-bit state by using an auxiliary generator with a 64-bit state to bootstrap the initial 256-bit state for the main generator. All later pseudo-random numbers come from the same stream. The state is thread local, i.e., providing a separate random number stream for each thread. Setting a new seed will determine the random number stream for that thread until it is reset to some other seed. This makes it possible to run independent identically distributed trials in separate threads without interactions with each other. Suitable 64-bit seeds can be obtained from hardware entropy by calling ``cmb_random_hwseed``. The various random number distributions are built on this generator. They use the fastest available algorithms without making any compromises on accuracy. A wide range of random number distributions are provided, both academically important ones like beta and gamma, and more empirical ones like triangular and PERT. For arbitrary non-uniform discrete distributions, efficient Vose alias sampling is provided. Most other pseudo-random number generators and distributions are not thread- safe. The internal generator state is often kept as static variables between calls, making it non-reentrant. Some common distributions, such as the typical Box-Muller method for normal variates, also depend on static variables to maintain state between calls, making it unsuitable for our purpose. Luckily, the algorithms used here are not only thread-safe, but also faster and statistically equally good or better. For mathematical details about the various distributions, the respective Wikipedia pages are highly recommended. Includes -------- - ``cmb_assert.h`` (:ref:`file_include_cmb_assert.h`) - ``inttypes.h`` - ``math.h`` - ``stdbool.h`` Included By ----------- - :ref:`file_include_cimba.h` Classes ------- - :ref:`exhale_struct_structcmb__random__alias` Functions --------- - :ref:`exhale_function_cmb__random_8h_1ab3773428b16b6394f6aeec92b630b54c` - :ref:`exhale_function_cmb__random_8h_1ad34d3bbf19987a2e7129c2a625a1a8a1` - :ref:`exhale_function_cmb__random_8h_1aa2bfb3b9daa4d7a26dbd53052269d095` - :ref:`exhale_function_cmb__random_8h_1a8c359b6267685fbd9e03840187924039` - :ref:`exhale_function_cmb__random_8h_1a12b2f6849010bfd4ca7121bbd1da3180` - :ref:`exhale_function_cmb__random_8h_1a77376370219cf3588e9fc21e864590f9` - :ref:`exhale_function_cmb__random_8h_1a563193ed6eef22e606b0e51bcfd37577` - :ref:`exhale_function_cmb__random_8h_1a1718b1247a53426731ca3f37715ac0a7` - :ref:`exhale_function_cmb__random_8h_1a00df26a3f3ff85d5d1213b1282b6b549` - :ref:`exhale_function_cmb__random_8h_1aa9240df34f8e0f263724b5a41b1b5e30` - :ref:`exhale_function_cmb__random_8h_1ad85be7389014ce5d4b3f31725f7cfcc9` - :ref:`exhale_function_cmb__random_8h_1a32c95d2915c30a641d143e90adaee596` - :ref:`exhale_function_cmb__random_8h_1a9669fd96f1027bbf1ae4f677aa07c7d6` - :ref:`exhale_function_cmb__random_8h_1a00bd44153d999a596d416351ee292fbe` - :ref:`exhale_function_cmb__random_8h_1a0ade2d1a4a359e522a8e9dcddbe020e1` - :ref:`exhale_function_cmb__random_8h_1af06380784e820c7692d949098c1978f7` - :ref:`exhale_function_cmb__random_8h_1aed1a3f03d465e6d059007df27b07194a` - :ref:`exhale_function_cmb__random_8h_1a1b29c98684fb3f568de8682e3ddc707f` - :ref:`exhale_function_cmb__random_8h_1ad9048bf60124af6e43fc737350d6e4e5` - :ref:`exhale_function_cmb__random_8h_1a6c93a4f9d183388e2993daaa60fb259c` - :ref:`exhale_function_cmb__random_8h_1a0ff9ee5bc6fb8cf0e7c39a14d87aeb80` - :ref:`exhale_function_cmb__random_8h_1afed6a78b32fc467abb477e071874457b` - :ref:`exhale_function_cmb__random_8h_1af05c8283c3c68b9b40550897bc1e2571` - :ref:`exhale_function_cmb__random_8h_1aedf2d5ba7995607f29d38d75f0660a82` - :ref:`exhale_function_cmb__random_8h_1a48cdc76e2fe239bafe745e4e628e7db4` - :ref:`exhale_function_cmb__random_8h_1a679b2098f33d0acb41daee3e8c45e03c` - :ref:`exhale_function_cmb__random_8h_1aaa00eed3e0d87d1c6956034be189149c` - :ref:`exhale_function_cmb__random_8h_1a6c39d9877dd17c101c7a6dc3e797e98b` - :ref:`exhale_function_cmb__random_8h_1a508ca8d65653105666c0d9158e55422f` - :ref:`exhale_function_cmb__random_8h_1aea6c61c6c3196781f49ae82e5aeeabbd` - :ref:`exhale_function_cmb__random_8h_1a2c0208ab1febd453ed693e6b2079cd62` - :ref:`exhale_function_cmb__random_8h_1a19104be8363bccbf3d7ca7c497f1ccf0` - :ref:`exhale_function_cmb__random_8h_1a3e68796e8b3e63f8fd7faeca89b558a0` - :ref:`exhale_function_cmb__random_8h_1a65473fb706f27df7f02126b508df6ce4` - :ref:`exhale_function_cmb__random_8h_1a5ad03c6db303bd7d53ff1c8fbb29dcdf` - :ref:`exhale_function_cmb__random_8h_1a5fb64c65d8d63ac2968634125c6b1171` - :ref:`exhale_function_cmb__random_8h_1a80a2c6ddea33fb0ef30d92ce3166420f` - :ref:`exhale_function_cmb__random_8h_1a8c6e5b7c33fbc91755c28cf2fb9449e2` - :ref:`exhale_function_cmb__random_8h_1a5f8b7df38d6a5a889dceacd07315c6a4` - :ref:`exhale_function_cmb__random_8h_1a6be5688a1dca038bcf1bb2b50b62ff19` - :ref:`exhale_function_cmb__random_8h_1a5ba01c31aeeaeb1496671edd46ae5f12` - :ref:`exhale_function_cmb__random_8h_1a3aefa52548028b86464ebbde4cd7f0bf` - :ref:`exhale_function_cmb__random_8h_1a3d54b600bcfdc42ff431957751465034` - :ref:`exhale_function_cmb__random_8h_1a90dc72415ce7800d708b694b9eb24dc8`