From 9a71ce2666614ed4761d92812cc01435ce57fd31 Mon Sep 17 00:00:00 2001 From: Michael Schellenberger Costa Date: Mon, 26 Sep 2016 12:26:38 +0200 Subject: [PATCH] Fixed minor casting bug in renadom stream and renamed them to camel case --- Random_Stream.h | 14 +++++++------- Thalamic_Column.cpp | 4 ++-- Thalamic_Column.h | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Random_Stream.h b/Random_Stream.h index 29d013e..269d5ef 100644 --- a/Random_Stream.h +++ b/Random_Stream.h @@ -29,11 +29,11 @@ #pragma once #include -class random_stream_normal { +class randomStreamNormal { public: - explicit random_stream_normal(double mean, double stddev) + explicit randomStreamNormal(double mean, double stddev) : mt(rand()), norm_dist(mean, stddev) {} - explicit random_stream_normal(double mean, double stddev, double seed) + explicit randomStreamNormal(double mean, double stddev, double seed) : mt(seed), norm_dist(mean, stddev) {} double operator ()(void) { return norm_dist(mt); } @@ -42,14 +42,14 @@ class random_stream_normal { std::normal_distribution norm_dist; }; -class random_stream_uniform_int { +class randomStreamUniformInt { public: - explicit random_stream_uniform_int(int lower_bound, int upper_bound) + explicit randomStreamUniformInt(int lower_bound, int upper_bound) : mt(rand()), uniform_dist(lower_bound, upper_bound) {} - explicit random_stream_uniform_int(int lower_bound, int upper_bound, double seed) + explicit randomStreamUniformInt(int lower_bound, int upper_bound, double seed) : mt(seed), uniform_dist(lower_bound, upper_bound) {} - double operator ()(void) { return uniform_dist(mt); } + int operator ()(void) { return uniform_dist(mt); } private: std::mt19937_64 mt; std::uniform_int_distribution<> uniform_dist; diff --git a/Thalamic_Column.cpp b/Thalamic_Column.cpp index f9dd008..7a5e710 100644 --- a/Thalamic_Column.cpp +++ b/Thalamic_Column.cpp @@ -44,10 +44,10 @@ void Thalamic_Column::set_RNG(void) { Rand_vars.reserve(2*numRandomVariables); for (unsigned i=0; i < numRandomVariables; ++i){ /* Add the RNG for I_{l}*/ - MTRands.push_back(random_stream_normal(0.0, dphi*dt)); + MTRands.push_back(randomStreamNormal(0.0, dphi*dt)); /* Add the RNG for I_{l,0} */ - MTRands.push_back(random_stream_normal(0.0, dt)); + MTRands.push_back(randomStreamNormal(0.0, dt)); /* Get the random number for the first iteration */ Rand_vars.push_back(MTRands[2*i]()); diff --git a/Thalamic_Column.h b/Thalamic_Column.h index 364711c..1d8e885 100644 --- a/Thalamic_Column.h +++ b/Thalamic_Column.h @@ -191,7 +191,7 @@ class Thalamic_Column { const std::vector B = {0.75, 0.75, 0.0, 0.0}; /* Random number generators */ - std::vector MTRands; + std::vector MTRands; /* Container for noise */ std::vector Rand_vars;