Maze Builder Docs 8.2.1
Loading...
Searching...
No Matches
mazes::randomizer Class Reference

Provides random-number generating capabilities. More...

#include <randomizer.h>

Public Member Functions

 randomizer ()
 Default constructor.
 
 ~randomizer ()
 Destructor.
 
 randomizer (const randomizer &other)
 Copy constructor.
 
randomizeroperator= (const randomizer &other)
 Copy assignment operator.
 
 randomizer (randomizer &&other) noexcept
 Move constructor.
 
randomizeroperator= (randomizer &&other) noexcept
 Move assignment operator.
 
int get_int (int low=0, int high=1) const noexcept
 Generates a random integer within a specified range.
 
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.
 
float get_float (float low=0.0f, float high=1.0f) const noexcept
 Generates a random float within a specified range.
 
void seed (unsigned long long seed=0) const noexcept
 Seeds the random number generator with the given seed value.
 
int operator() (const int low, const int high) const noexcept
 Gets a random integer within a specified range.
 

Detailed Description

Provides random-number generating capabilities.

This class provides methods for generating random numbers

Constructor & Destructor Documentation

◆ randomizer() [1/2]

mazes::randomizer::randomizer ( const randomizer & other)

Copy constructor.

Parameters
otherThe randomizer object to copy from

◆ randomizer() [2/2]

mazes::randomizer::randomizer ( randomizer && other)
noexcept

Move constructor.

Parameters
otherThe randomizer object to move from

Member Function Documentation

◆ get_float()

float mazes::randomizer::get_float ( float low = 0.0f,
float high = 1.0f ) const
nodiscardnoexcept

Generates a random float within a specified range.

Parameters
lowThe lower bound of the float (inclusive).
highThe upper bound of the float (inclusive).
Returns
A random float between the specified range [low, high].

◆ get_int()

int mazes::randomizer::get_int ( int low = 0,
int high = 1 ) const
noexcept

Generates a random integer within a specified range.

Parameters
lowThe lower bound of the integer (inclusive).
highThe upper bound of the integer (inclusive).
Returns
A random integer between the specified range [low, high].

◆ get_vector_ints()

std::vector< int > mazes::randomizer::get_vector_ints ( int low = 0,
int high = 1,
int count = 1 ) const
nodiscardnoexcept

Generates a shuffled vector of all integers in the specified range.

Parameters
lowThe lower bound of the integer(s) (inclusive).
highThe upper bound of the integer(s) (inclusive).
countThe number of random integers to generate
Returns
A vector containing all integers in [low, high] in random order

◆ operator()()

int mazes::randomizer::operator() ( const int low,
const int high ) const
inlinenoexcept

Gets a random integer within a specified range.

Parameters
lowThe lower bound of the integer (inclusive).
highThe upper bound of the integer (inclusive).
Returns
A random integer within the specified range.

◆ operator=() [1/2]

randomizer & mazes::randomizer::operator= ( const randomizer & other)

Copy assignment operator.

Parameters
otherThe randomizer object to copy from
Returns
Reference to the current object

◆ operator=() [2/2]

randomizer & mazes::randomizer::operator= ( randomizer && other)
noexcept

Move assignment operator.

Parameters
otherThe randomizer object to move from
Returns
Reference to the current object

◆ seed()

void mazes::randomizer::seed ( unsigned long long seed = 0) const
noexcept

Seeds the random number generator with the given seed value.

Parameters
seedThe seed value to initialize the random number generator.

The documentation for this class was generated from the following file: