Pacman Torben Petré
Loading...
Searching...
No Matches
Random.h
Go to the documentation of this file.
1#ifndef RANDOM_H
2#define RANDOM_H
3
4#include <random>
5
6
7namespace logic {
8
12 class Random {
13 public:
17 Random(Random &other) = delete;
18 void operator=(const Random &) = delete;
19
20
25 [[nodiscard]] static Random& getInstance();
26
31 [[nodiscard]] float getFloat();
32
40 [[nodiscard]] int getInt(int min, int max);
41
42 private:
43 Random();
44
45 std::mt19937 generator;
46 };
47}
48
49
50
51
52#endif //RANDOM_H
float getFloat()
Function that returns a random float value between 0 and 1.
Definition Random.cpp:23
static Random & getInstance()
Returns an instance of the Random class.
Definition Random.cpp:12
void operator=(const Random &)=delete
int getInt(int min, int max)
Helper function that returns a random value between the given min and max. Including the max.
Definition Random.cpp:18
Random(Random &other)=delete
Definition Difficulty.h:6