The Battle for Wesnoth  1.19.7+dev
Public Member Functions | Protected Member Functions | Private Attributes | List of all members
randomness::rng_deterministic Class Reference

This rng is used when the normal synced rng is not available this is currently only he case at the very start of the scenario (random generation of starting units traits). More...

#include <random_deterministic.hpp>

Inheritance diagram for randomness::rng_deterministic:

Public Member Functions

 rng_deterministic (mt_rng &gen)
 
virtual ~rng_deterministic ()
 
- Public Member Functions inherited from randomness::rng
 rng ()
 
uint32_t next_random ()
 Provides the next random draw. More...
 
virtual ~rng ()
 
unsigned int get_random_calls () const
 Provides the number of random calls to the rng in this context. More...
 
int get_random_int (int min, int max)
 
bool get_random_bool (double probability)
 This helper method returns true with the probability supplied as a parameter. More...
 
double get_random_double ()
 This helper method returns a floating-point number in the range [0,1[. More...
 
template<typename T >
T::difference_type get_random_element (T first, T last)
 This helper method selects a random element from a container of floating-point numbers. More...
 
uint32_t operator() ()
 
virtual bool is_networked () const
 Is this random source networked? If it is it's very important we do actually use this random source to stay in-sync. More...
 

Protected Member Functions

virtual uint32_t next_random_impl ()
 

Private Attributes

mt_rnggenerator_
 

Additional Inherited Members

- Public Types inherited from randomness::rng
using result_type = uint32_t
 
- Static Public Member Functions inherited from randomness::rng
static rngdefault_instance ()
 
- Protected Attributes inherited from randomness::rng
unsigned int random_calls_
 

Detailed Description

This rng is used when the normal synced rng is not available this is currently only he case at the very start of the scenario (random generation of starting units traits).

or during the "Deterministic SP mode"

Definition at line 31 of file random_deterministic.hpp.

Constructor & Destructor Documentation

◆ rng_deterministic()

randomness::rng_deterministic::rng_deterministic ( mt_rng gen)

Definition at line 22 of file random_deterministic.cpp.

◆ ~rng_deterministic()

randomness::rng_deterministic::~rng_deterministic ( )
virtual

Definition at line 28 of file random_deterministic.cpp.

Member Function Documentation

◆ next_random_impl()

uint32_t randomness::rng_deterministic::next_random_impl ( )
protectedvirtual

Implements randomness::rng.

Definition at line 33 of file random_deterministic.cpp.

References generator_, and randomness::mt_rng::get_next_random().

Member Data Documentation

◆ generator_

mt_rng& randomness::rng_deterministic::generator_
private

Definition at line 40 of file random_deterministic.hpp.

Referenced by next_random_impl().


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