diff options
author | Adrian Kummerlaender | 2016-03-29 20:39:19 +0200 |
---|---|---|
committer | Adrian Kummerlaender | 2016-03-29 20:39:19 +0200 |
commit | 26101aeb8ea28bd180b30fc67cba81baadbba8ee (patch) | |
tree | 33044ef62a61bbdd56f4d83b7dc59b7049431547 /src/random.h | |
parent | 4e1a5ff8edfa09e74fc708521024fd359d96f7b0 (diff) | |
download | justify-26101aeb8ea28bd180b30fc67cba81baadbba8ee.tar justify-26101aeb8ea28bd180b30fc67cba81baadbba8ee.tar.gz justify-26101aeb8ea28bd180b30fc67cba81baadbba8ee.tar.bz2 justify-26101aeb8ea28bd180b30fc67cba81baadbba8ee.tar.lz justify-26101aeb8ea28bd180b30fc67cba81baadbba8ee.tar.xz justify-26101aeb8ea28bd180b30fc67cba81baadbba8ee.tar.zst justify-26101aeb8ea28bd180b30fc67cba81baadbba8ee.zip |
Move random index generation into utility class
Diffstat (limited to 'src/random.h')
-rw-r--r-- | src/random.h | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/random.h b/src/random.h new file mode 100644 index 0000000..386dc21 --- /dev/null +++ b/src/random.h @@ -0,0 +1,34 @@ +#pragma once + +#include <random> + +namespace utility { + +class Random { + public: + class Range { + public: + std::size_t get(); + + protected: + friend class Random; + + Range(std::mt19937* const, const std::size_t, const std::size_t); + + private: + std::mt19937* const generator_; + std::uniform_int_distribution<std::size_t> distribution_; + }; + + Random(); + + Range makeRange(const std::size_t, const std::size_t); + + private: + std::random_device device_; + std::mt19937 generator_; + +}; + + +} |