TrinityCore
Random.cpp File Reference
#include "Random.h"
#include "Errors.h"
#include "SFMTRand.h"
#include <memory>
#include <random>
+ Include dependency graph for Random.cpp:

Go to the source code of this file.

Functions

static SFMTRandGetRng ()
 
int32 irand (int32 min, int32 max)
 
uint32 urand (uint32 min, uint32 max)
 
uint32 urandms (uint32 min, uint32 max)
 
float frand (float min, float max)
 
Milliseconds randtime (Milliseconds min, Milliseconds max)
 
uint32 rand32 ()
 
float rand_norm ()
 
float rand_chance ()
 
uint32 urandweighted (size_t count, double const *chances)
 

Variables

static thread_local std::unique_ptr< SFMTRandsfmtRand
 
static RandomEngine engine
 

Function Documentation

◆ frand()

float frand ( float  min,
float  max 
)

Definition at line 55 of file Random.cpp.

+ Here is the caller graph for this function:

◆ GetRng()

static SFMTRand * GetRng ( )
static

Definition at line 27 of file Random.cpp.

+ Here is the caller graph for this function:

◆ irand()

int32 irand ( int32  min,
int32  max 
)

Definition at line 35 of file Random.cpp.

+ Here is the caller graph for this function:

◆ rand32()

uint32 rand32 ( )

Definition at line 70 of file Random.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ rand_chance()

float rand_chance ( )

Definition at line 81 of file Random.cpp.

+ Here is the caller graph for this function:

◆ rand_norm()

float rand_norm ( )

Definition at line 75 of file Random.cpp.

+ Here is the caller graph for this function:

◆ randtime()

Milliseconds randtime ( Milliseconds  min,
Milliseconds  max 
)

Definition at line 62 of file Random.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ urand()

uint32 urand ( uint32  min,
uint32  max 
)

Definition at line 42 of file Random.cpp.

◆ urandms()

uint32 urandms ( uint32  min,
uint32  max 
)

Definition at line 49 of file Random.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ urandweighted()

uint32 urandweighted ( size_t  count,
double const *  chances 
)

Definition at line 87 of file Random.cpp.

+ Here is the caller graph for this function:

Variable Documentation

◆ engine

RandomEngine engine
static

Definition at line 25 of file Random.cpp.

◆ sfmtRand

thread_local std::unique_ptr<SFMTRand> sfmtRand
static

Definition at line 24 of file Random.cpp.