Maze Builder Docs 8.2.1
Loading...
Searching...
No Matches
randomizer.h
Go to the documentation of this file.
1#ifndef RANDOMIZER_H
2#define RANDOMIZER_H
3
4#include <vector>
5#include <memory>
6
9namespace mazes
10{
15 {
16 public:
19
22
25 randomizer(const randomizer& other);
26
31
34 randomizer(randomizer&& other) noexcept;
35
39 randomizer& operator=(randomizer&& other) noexcept;
40
45 int get_int(int low = 0, int high = 1) const noexcept;
46
52 [[nodiscard]] std::vector<int> get_vector_ints(int low = 0, int high = 1, int count = 1) const noexcept;
53
58 [[nodiscard]] float get_float(float low = 0.0f, float high = 1.0f) const noexcept;
59
62 void seed(unsigned long long seed = 0) const noexcept;
63
68 int operator()(const int low, const int high) const noexcept
69 {
70 return get_int(low, high);
71 }
72
73 private:
74 class randomizer_impl;
75
76 std::unique_ptr<randomizer_impl> m_impl;
77 };
78}
79#endif // RANDOMIZER_H
Provides random-number generating capabilities.
Definition randomizer.h:15
void seed(unsigned long long seed=0) const noexcept
Seeds the random number generator with the given seed value.
~randomizer()
Destructor.
int get_int(int low=0, int high=1) const noexcept
Generates a random integer within a specified range.
randomizer(randomizer &&other) noexcept
Move constructor.
randomizer & operator=(randomizer &&other) noexcept
Move assignment operator.
std::vector< int > get_vector_ints(int low=0, int high=1, int count=1) const noexcept
Generates a shuffled vector of all integers in the specified range.
randomizer()
Default constructor.
randomizer & operator=(const randomizer &other)
Copy assignment operator.
float get_float(float low=0.0f, float high=1.0f) const noexcept
Generates a random float within a specified range.
randomizer(const randomizer &other)
Copy constructor.