Permalink
Newer
Older
100644 57 lines (51 sloc) 2.38 KB
Apr 24, 2014 @miscco Cleanup. Made comments line save
1 /*
Nov 9, 2015 @miscco Updated the code with correct license.
2 * Copyright (c) 2015 University of Lübeck
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a copy
5 * of this software and associated documentation files (the "Software"), to deal
6 * in the Software without restriction, including without limitation the rights
7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 * copies of the Software, and to permit persons to whom the Software is
9 * furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 * THE SOFTWARE.
21 *
22 * AUTHORS: Michael Schellenberger Costa: mschellenbergercosta@gmail.com
Dec 29, 2015 @miscco General code cleanup.
23 * Stefanie Gareis: gareis@inb.uni-luebeck.de
Nov 9, 2015 @miscco Updated the code with correct license.
24 */
Apr 24, 2014 @miscco Cleanup. Made comments line save
25
Sep 13, 2016 @miscco Major cleanup and moderinization
26 /******************************************************************************/
27 /* Random number streams */
28 /******************************************************************************/
Mar 1, 2014 @miscco New implementation of the thalamo-cortical model
29 #pragma once
Dec 29, 2015 @miscco General code cleanup.
30 #include <random>
Mar 1, 2014 @miscco New implementation of the thalamo-cortical model
31
Sep 26, 2016 @miscco Fixed a minor casting bug in random stream implementation and renamed…
32 class randomStreamNormal {
Sep 13, 2016 @miscco Major cleanup and moderinization
33 public:
Sep 26, 2016 @miscco Fixed a minor casting bug in random stream implementation and renamed…
34 explicit randomStreamNormal(double mean, double stddev)
Sep 13, 2016 @miscco Major cleanup and moderinization
35 : mt(rand()), norm_dist(mean, stddev) {}
Sep 26, 2016 @miscco Fixed a minor casting bug in random stream implementation and renamed…
36 explicit randomStreamNormal(double mean, double stddev, double seed)
Sep 13, 2016 @miscco Major cleanup and moderinization
37 : mt(seed), norm_dist(mean, stddev) {}
38
39 double operator ()(void) { return norm_dist(mt); }
40 private:
Dec 29, 2015 @miscco General code cleanup.
41 std::mt19937_64 mt;
42 std::normal_distribution<double> norm_dist;
43 };
44
Sep 26, 2016 @miscco Fixed a minor casting bug in random stream implementation and renamed…
45 class randomStreamUniformInt {
Sep 13, 2016 @miscco Major cleanup and moderinization
46 public:
Sep 26, 2016 @miscco Fixed a minor casting bug in random stream implementation and renamed…
47 explicit randomStreamUniformInt(int lower_bound, int upper_bound)
Sep 13, 2016 @miscco Major cleanup and moderinization
48 : mt(rand()), uniform_dist(lower_bound, upper_bound) {}
Sep 26, 2016 @miscco Fixed a minor casting bug in random stream implementation and renamed…
49 explicit randomStreamUniformInt(int lower_bound, int upper_bound, double seed)
Sep 13, 2016 @miscco Major cleanup and moderinization
50 : mt(seed), uniform_dist(lower_bound, upper_bound) {}
51
Sep 26, 2016 @miscco Fixed a minor casting bug in random stream implementation and renamed…
52 int operator ()(void) { return uniform_dist(mt); }
Sep 13, 2016 @miscco Major cleanup and moderinization
53 private:
Dec 29, 2015 @miscco General code cleanup.
54 std::mt19937_64 mt;
55 std::uniform_int_distribution<> uniform_dist;
56 };