Cuberite
A lightweight, fast and extensible game server for Minecraft
|
Class to wrap any random engine to provide a more convenient interface. More...
#include <FastRandom.h>
Public Member Functions | |
cRandomWrapper () | |
Initialize with a low quality seed. More... | |
template<class SeedSeq > | |
cRandomWrapper (SeedSeq &a_SeedSeq) | |
Initialize with a SeedSequence. More... | |
RandomEngine & | Engine () |
Returns a reference to the underlying random engine. More... | |
bool | RandBool (double a_TrueProbability=0.5) |
Return a random bool with the given probability of being true. More... | |
template<class IntType = int> | |
IntType | RandInt () |
Return a random IntType in the range [0, std::numeric_limits<IntType>::max()]. More... | |
template<class IntType = int> | |
IntType | RandInt (IntType a_Max) |
Return a random IntType in the range [0, a_Max]. More... | |
template<class IntType = int> | |
IntType | RandInt (IntType a_Min, IntType a_Max) |
Return a random IntType in the range [a_Min, a_Max]. More... | |
template<class RealType = float> | |
RealType | RandReal () |
Return a random RealType in the range [0, 1). More... | |
template<class RealType = float> | |
RealType | RandReal (RealType a_Max) |
Return a random RealType in the range [0, a_Max). More... | |
template<class RealType = float> | |
RealType | RandReal (RealType a_Min, RealType a_Max) |
Return a random RealType in the range [a_Min, a_Max). More... | |
Private Attributes | |
RandomEngine | m_Engine |
Class to wrap any random engine to provide a more convenient interface.
Definition at line 57 of file FastRandom.h.
|
inline |
Initialize with a low quality seed.
Definition at line 61 of file FastRandom.h.
|
inline |
Initialize with a SeedSequence.
Definition at line 69 of file FastRandom.h.
|
inline |
Returns a reference to the underlying random engine.
Definition at line 168 of file FastRandom.h.
|
inline |
Return a random bool with the given probability of being true.
Definition at line 158 of file FastRandom.h.
|
inline |
Return a random IntType in the range [0, std::numeric_limits<IntType>::max()].
Definition at line 111 of file FastRandom.h.
|
inline |
Return a random IntType in the range [0, a_Max].
Definition at line 98 of file FastRandom.h.
|
inline |
Return a random IntType in the range [a_Min, a_Max].
Definition at line 78 of file FastRandom.h.
|
inline |
Return a random RealType in the range [0, 1).
Definition at line 147 of file FastRandom.h.
|
inline |
Return a random RealType in the range [0, a_Max).
Definition at line 135 of file FastRandom.h.
|
inline |
Return a random RealType in the range [a_Min, a_Max).
Definition at line 123 of file FastRandom.h.
|
private |
Definition at line 175 of file FastRandom.h.