SaturnRingLibrary 0.6
SGL wrapper
 
Loading...
Searching...
No Matches
SRL::Math::Random Class Reference

Detailed Description

Pseudo-Random number generator.

Note
This generator uses Xorshift (see https://en.wikipedia.org/wiki/Xorshift)

#include <srl_math.hpp>

Public Member Functions

 Random ()
 Construct a new pseudo-random number generator.
 
 Random (uint32_t seed)
 Construct a new pseudo-random number generator.
 
 ~Random ()
 Destroy the pseudo-random number generator object.
 
uint32_t GetNumber ()
 Get next pseudo-random number.
 
int32_t GetNumber (int32_t from, int32_t to)
 Get next pseudo-random number.
 

Constructor & Destructor Documentation

◆ Random()

SRL::Math::Random::Random ( uint32_t seed)
inline

Construct a new pseudo-random number generator.

Parameters
seedStarting seed

Member Function Documentation

◆ GetNumber() [1/2]

uint32_t SRL::Math::Random::GetNumber ( )
inline

Get next pseudo-random number.

Returns
Generated number in a full range

◆ GetNumber() [2/2]

int32_t SRL::Math::Random::GetNumber ( int32_t from,
int32_t to )
inline

Get next pseudo-random number.

Parameters
fromInclusive start of the range
toInclusive end of the range
Returns
Generated number in a range