bpf::math::Random class

Random number generator utility

Constructors, destructors, conversion operators

Random()
Random(long seed) explicit

Public functions

auto NextInt(fint max = bpf::Int::MaxValue) -> fint
auto NextInt(fint min, fint max) -> fint
auto NextByte(uint8 max = bpf::UInt8::MaxValue) -> uint8
auto NextByte(uint8 min, uint8 max) -> uint8
auto NextShort(uint16 max = bpf::UInt16::MaxValue) -> uint16
auto NextShort(uint16 min, uint16 max) -> uint16
auto NextFloat(float min = 0) -> float
auto NextDouble() -> double

Function documentation

bpf::math::Random::Random()

Constructs a random with a default seed

bpf::math::Random::Random(long seed) explicit

Parameters
seed random seed to use

Constructs a random from a custom seed

fint bpf::math::Random::NextInt(fint max = bpf::Int::MaxValue)

Parameters
max maximum value
Returns new 32 bit integer

Generate a new random integer

fint bpf::math::Random::NextInt(fint min, fint max)

Parameters
min minimum value
max maximum value
Returns new 32 bit integer

Generate a new random integer

uint8 bpf::math::Random::NextByte(uint8 max = bpf::UInt8::MaxValue)

Parameters
max maximum value
Returns new 8 bit integer

Generate a new random integer

uint8 bpf::math::Random::NextByte(uint8 min, uint8 max)

Parameters
min minimum value
max maximum value
Returns new 8 bit integer

Generate a new random integer

uint16 bpf::math::Random::NextShort(uint16 max = bpf::UInt16::MaxValue)

Parameters
max maximum value
Returns new 16 bit integer

Generate a new random integer

uint16 bpf::math::Random::NextShort(uint16 min, uint16 max)

Parameters
min minimum value
max maximum value
Returns new 16 bit integer

Generate a new random integer

float bpf::math::Random::NextFloat(float min = 0)

Parameters
min minimum value
Returns random float between 0 and 1 added with min

Generate a new random float

double bpf::math::Random::NextDouble()

Returns random double between 0 and 1

Generate a new random double