summaryrefslogtreecommitdiff
path: root/src/random.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/random.h')
-rw-r--r--src/random.h10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/random.h b/src/random.h
index a18f5b6..7f53c05 100644
--- a/src/random.h
+++ b/src/random.h
@@ -56,12 +56,16 @@ private:
// minstd_rand0, so make sure we use that all platforms regardless of which
// stdlib we link with.
std::minstd_rand0 generator;
+
+ float generateFloat();
+
+ // variables for normalDistribution
+ bool has_saved_value = false;
+ float saved_value;
};
template <typename T>
T& Random::choose(std::vector<T>& vec)
{
- std::uniform_int_distribution<size_t> distribution(0, vec.size()-1);
- size_t rand_index = distribution(generator);
- return vec[rand_index];
+ return vec[intInRange(0, vec.size() - 1)];
}