Skip to content

Instantly share code, notes, and snippets.

View jrade's full-sized avatar

Johan Råde jrade

View GitHub Profile
@jrade
jrade / random.h
Created April 15, 2021 13:19 — forked from Leandros/random.h
C++ Pseudo Random Number Generators
/* Copyright (c) 2018 Arvid Gerstmann. */
/* This code is licensed under MIT license. */
#ifndef AG_RANDOM_H
#define AG_RANDOM_H
class splitmix
{
public:
using result_type = uint32_t;
static constexpr result_type (min)() { return 0; }
@jrade
jrade / FastExp.h
Created March 19, 2021 06:09
Fast approximate exponential function
// Copyright 2021 Johan Rade (johan.rade@gmail.com)
// Distributed under the MIT license (https://opensource.org/licenses/MIT)
#ifndef FAST_EXP_H
#define FAST_EXP_H
#include <cstdint>
#include <cstring>