This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// badseed: | |
// Provides examples showing std::seed_seq is not a bijection | |
// i.e., that some seeds get repeated for different inputs | |
// and thus some other seeds must never be generated | |
#include <random> | |
#include <iostream> | |
#include <iomanip> | |
#include <cstddef> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Random-Number Utilities (randutil) | |
* Addresses common issues with C++11 random number generation. | |
* Makes good seeding easier, and makes using RNGs easy while retaining | |
* all the power. | |
* | |
* The MIT License (MIT) | |
* | |
* Copyright (c) 2015-2022 Melissa E. O'Neill | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef XORSHIFT_HPP_INCLUDED | |
#define XORSHIFT_HPP_INCLUDED 1 | |
/* | |
* A C++ implementation of a family of truncated XorShift* generators. | |
* | |
* The MIT License (MIT) | |
* | |
* Copyright (c) 2017-19 Melissa E. O'Neill | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef XOROSHIRO_HPP_INCLUDED | |
#define XOROSHIRO_HPP_INCLUDED 1 | |
/* | |
* A C++ implementation of a family of Xoroshiro generators. | |
* | |
* See: | |
* https://en.wikipedia.org/wiki/Xoroshiro128%2B | |
* http://xoroshiro.di.unimi.it/xoroshiro128plus.c | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef JSF_HPP_INCLUDED | |
#define JSF_HPP_INCLUDED 1 | |
/* | |
* A C++ implementation of a Bob Jenkins Small Fast (Noncryptographic) PRNGs | |
* | |
* The MIT License (MIT) | |
* | |
* Copyright (c) 2018 Melissa E. O'Neill | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef GJRAND_HPP_INCLUDED | |
#define GJRAND_HPP_INCLUDED 1 | |
/* | |
* A C++ implementation of David Blackman's GJrand PRNG(s) | |
* | |
* The MIT License (MIT) | |
* | |
* Copyright (c) 2018 Melissa E. O'Neill | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef SFC_HPP_INCLUDED | |
#define SFC_HPP_INCLUDED 1 | |
/* | |
* A C++ implementation of Chris Doty-Humphrey's SFC PRNG(s) | |
* | |
* The MIT License (MIT) | |
* | |
* Copyright (c) 2018 Melissa E. O'Neill | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef LEHMER_HPP_INCLUDED | |
#define LEHMER_HPP_INCLUDED 1 | |
/* | |
* A C++ implementation of fast, 128-bit, Lehmer-style PRNGs | |
* | |
* The MIT License (MIT) | |
* | |
* Copyright (c) 2018 Melissa E. O'Neill | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef RND_ADAPTERS_HPP_INCLUDED | |
#define RND_ADAPTERS_HPP_INCLUDED 1 | |
/* | |
* A C++ implementation of a set of PRNG adapters. | |
* | |
* The MIT License (MIT) | |
* | |
* Copyright (c) 2018 Melissa E. O'Neill | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Xoshiro256** Bad Repeats Demonstration | |
* | |
* gcc -std=c99 -Wall -o xoshiro-bad-repeats xoshiro-bad-repeats.c | |
* ./xoshiro-bad-repeats | less | |
* | |
* In a PRNG the size of Xoshiro256**, we should expect about 10 "5-in-7" | |
* repeats. Xoshiro256** has more than 18 billion billion of them, which | |
* is rather too many. In fact, the number of bad repeats is larger than | |
* the 2**64 range of the generator! |
OlderNewer