Lattice Microbes 2.5
This is for whole cell modeling
Loading...
Searching...
No Matches
RandomGenerator.h
Go to the documentation of this file.
1/*
2 * University of Illinois Open Source License
3 * Copyright 2011-2018 Luthey-Schulten Group,
4 * All rights reserved.
5 *
6 * Developed by: Luthey-Schulten Group
7 * University of Illinois at Urbana-Champaign
8 * http://www.scs.uiuc.edu/~schulten
9 *
10 * Permission is hereby granted, free of charge, to any person obtaining a copy of
11 * this software and associated documentation files (the Software), to deal with
12 * the Software without restriction, including without limitation the rights to
13 * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
14 * of the Software, and to permit persons to whom the Software is furnished to
15 * do so, subject to the following conditions:
16 *
17 * - Redistributions of source code must retain the above copyright notice,
18 * this list of conditions and the following disclaimers.
19 *
20 * - Redistributions in binary form must reproduce the above copyright notice,
21 * this list of conditions and the following disclaimers in the documentation
22 * and/or other materials provided with the distribution.
23 *
24 * - Neither the names of the Luthey-Schulten Group, University of Illinois at
25 * Urbana-Champaign, nor the names of its contributors may be used to endorse or
26 * promote products derived from this Software without specific prior written
27 * permission.
28 *
29 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
30 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
31 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
32 * THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
33 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
34 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
35 * OTHER DEALINGS WITH THE SOFTWARE.
36 *
37 * Author(s): Elijah Roberts
38 */
39
40#ifndef LM_RNG_RANDOMGENERATOR_H_
41#define LM_RNG_RANDOMGENERATOR_H_
42
43#include "core/Types.h"
44
45namespace lm {
46namespace rng {
47
51{
52public:
56 {
57 NONE = 0x00,
58 UNIFORM = 0x01,
60 NORMAL = 0x04,
61 ALL = 0xFF
62 };
63
64public:
65 RandomGenerator(uint32_t seedTop, uint32_t seedBottom, Distributions availableDists=(Distributions)(ALL));
66 virtual ~RandomGenerator() {}
67
70 virtual uint64_t getSeed() {return seed;}
71
74 virtual uint32_t getRandom()=0;
77 virtual double getRandomDouble()=0;
80 virtual double getExpRandomDouble()=0;
83 virtual double getNormRandomDouble()=0;
84
88 virtual void getRandomDoubles(double * rngs, int numberRNGs);
92 virtual void getExpRandomDoubles(double * rngs, int numberRNGs);
96 virtual void getNormRandomDoubles(double * rngs, int numberRNGs);
97
98protected:
99 uint64_t seed; // seed for the simulation
100 Distributions availableDists; // Which distributions are available to the simulation
101};
102
103}
104}
105
106#endif
Distributions availableDists
Definition RandomGenerator.h:100
virtual void getRandomDoubles(double *rngs, int numberRNGs)
Get a number of random doubles.
Definition RandomGenerator.cpp:69
uint64_t seed
Definition RandomGenerator.h:99
virtual uint32_t getRandom()=0
Get a random integer.
Distributions
Types of random number generators that are allowed.
Definition RandomGenerator.h:56
@ ALL
Definition RandomGenerator.h:61
@ UNIFORM
Definition RandomGenerator.h:58
@ NORMAL
Definition RandomGenerator.h:60
@ EXPONENTIAL
Definition RandomGenerator.h:59
@ NONE
Definition RandomGenerator.h:57
virtual void getExpRandomDoubles(double *rngs, int numberRNGs)
Get a number of random exponentially distiributed doubles.
Definition RandomGenerator.cpp:77
RandomGenerator(uint32_t seedTop, uint32_t seedBottom, Distributions availableDists=(Distributions)(ALL))
Definition RandomGenerator.cpp:54
virtual ~RandomGenerator()
Definition RandomGenerator.h:66
virtual double getNormRandomDouble()=0
Get a random normally distributed double.
virtual double getExpRandomDouble()=0
Get a random exponentially distributed double.
virtual void getNormRandomDoubles(double *rngs, int numberRNGs)
Get a number of random normally distributed doubles.
Definition RandomGenerator.cpp:85
virtual double getRandomDouble()=0
Get a random double.
virtual uint64_t getSeed()
Get the current seed.
Definition RandomGenerator.h:70
Definition RandomGenerator.cpp:52
Definition Capsule.cpp:46