Skip to content

Instantly share code, notes, and snippets.

@imneme
imneme / jsf.hpp
Created May 28, 2018
A C++ Implementation of Bob Jenkins's Small Fast Noncryptographic PRNG (JSF)
View jsf.hpp
#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
*
@imneme
imneme / sfc.hpp
Last active Sep 6, 2022
A C++ implementation of Chris Doty-Humphrey's SFC PRNG(s)
View sfc.hpp
#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
*
@imneme
imneme / splitmix.hpp
Created Jul 4, 2018
A C++ implementation of SplitMix
View splitmix.hpp
#ifndef SPLITMIX_HPP_INCLUDED
#define SPLITMIX_HPP_INCLUDED 1
/*
* A C++ implementation of SplitMix
* Original design by Guy L. Steele, Jr., Doug Lea and Christine H. Flood
* Described in _Fast splittable pseudorandom number generators_
* http://dx.doi.org/10.1145/2714064.2660195 and implemented in
* Java 8 as SplittableRandom
* Based on code from the original paper, with revisions based on changes
@imneme
imneme / randutils.hpp
Last active Jul 27, 2022
Addresses common issues with C++11 random number generation; makes good seeding easier, and makes using RNGs easy while retaining all the power.
View randutils.hpp
/*
* 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
*
@imneme
imneme / lehmer.hpp
Created Jun 9, 2018
A C++ implementation of 128-bit Lehmer-style PRNGs
View lehmer.hpp
#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
*
@imneme
imneme / gjrand.hpp
Created May 28, 2018
A C++ implementation of David Blackman's GJrand PRNG(s)
View gjrand.hpp
#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
*
@imneme
imneme / xoshiro.hpp
Created Jul 4, 2018
A C++ implementation of a family of Xoshiro generators
View xoshiro.hpp
#ifndef XOSHIRO_HPP_INCLUDED
#define XOSHIRO_HPP_INCLUDED 1
/*
* A C++ implementation of a family of Xoshiro generators.
*
* See:
* https://arxiv.org/abs/1805.01407
* http://xoshiro.di.unimi.it/xoshiro256plus.c
* http://xoshiro.di.unimi.it/xoshiro256starstar.c
@imneme
imneme / xorshift.hpp
Last active Apr 8, 2022
A Family of Truncated XorShift* PRNGs
View xorshift.hpp
#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
*
@imneme
imneme / chacha.hpp
Last active Nov 19, 2021 — forked from orlp/chacha.h
C++11 ChaCha implementation.
View chacha.hpp
#ifndef CHACHA_HPP_INCLUDED
#define CHACHA_HPP_INCLUDED 1
/*
* A C++ version of ChaCha PRNG (*modified* from Orson Peters original code)
*
* Changes Copyright (c) 2017-18 Melissa E. O'Neill, licence as below.
*
* Changes compared to original 2015 version:
* - Some formatting fixes
@imneme
imneme / xoshiro256-similarity.c
Created Dec 4, 2020
This code shows self-similarity issues with Vigna's xoshiro256**. The original version of this code was written by Tyge Løvset.
View xoshiro256-similarity.c
/*
* Show self-similarity issues with Vigna's xoshiro256**
*
* Originally posted in a NumPy developers discussion by Tyge Løvset
* but simplified to only mix 32 outputs.
*
* Compile, and then test with PractRand by running
*
* ./xoshiro256-similarity \
* | ./RNG_test stdin64 -te 1 -tlmin 15 -tlmax 50 -tlmaxonly -multithreaded