Loading...
Searching...
No Matches
RandomNumbers.h
Go to the documentation of this file.
1/*
2** This file is part of eOn.
3**
4** SPDX-License-Identifier: BSD-3-Clause
5**
6** Copyright (c) 2010--present, eOn Development Team
7** All rights reserved.
8**
9** Repo:
10** https://github.com/TheochemUI/eOn
11*/
12#pragma once
13
14namespace eonc {
15
16// Random number generator constants
17constexpr double IM = 2147483647.0;
18constexpr double AM = 1.0 / IM;
19constexpr int NTAB = 32;
20constexpr int NDIV = 1 + (IM / NTAB);
21constexpr double EPS = 1.2e-7;
22constexpr double RNMX = 1.0 - EPS;
23constexpr long IM1 = 2147483563;
24constexpr long IM2 = 2147483399;
25constexpr long IMM1 = IM1 - 1;
26constexpr long IA1 = 40014;
27constexpr long IA2 = 40692;
28constexpr long IQ1 = 53668;
29constexpr long IQ2 = 52774;
30constexpr long IR1 = 12211;
31constexpr long IR2 = 3791;
32
33namespace rng {
34
35double random(long newSeed = 0);
36double randomDouble();
37double randomDouble(int max);
38double randomDouble(long max);
39double randomDouble(double max);
40long randomInt(int lower, int upper);
41double gaussRandom(double avg, double std);
42
43} // namespace rng
44
45} // namespace eonc
double random(long newSeed=0)
long randomInt(int lower, int upper)
double randomDouble()
double gaussRandom(double avg, double std)
RAII resource manager for the ARTn C library with global synchronization.
constexpr double AM
constexpr int NDIV
constexpr long IA2
constexpr double EPS
constexpr long IR2
constexpr long IQ1
constexpr int NTAB
constexpr long IA1
constexpr long IQ2
constexpr long IM1
constexpr long IMM1
constexpr long IM2
constexpr double IM
constexpr long IR1
constexpr double RNMX