CARLA
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
URandomEngine Class Reference

#include <RandomEngine.h>

+ Inheritance diagram for URandomEngine:

Public Member Functions

uint32 GetState () const
 The engine's state, to continue its exact sequence elsewhere (a Multi-GPU secondary's mirror of a sensor).
 
void SetState (uint32 State)
 Continue from State, as GetState returned it; an impossible value is ignored.
 
Uniform distribution
float GetUniformFloat ()
 
float GetUniformFloatInRange (float Minimum, float Maximum)
 
int32 GetUniformIntInRange (int32 Minimum, int32 Maximum)
 
bool GetUniformBool ()
 
Other distributions
bool GetBernoulliDistribution (float P)
 
int32 GetBinomialDistribution (int32 T, float P)
 
int32 GetPoissonDistribution (float Mean)
 
float GetExponentialDistribution (float Lambda)
 
float GetNormalDistribution (float Mean, float StandardDeviation)
 
Sampling distributions
bool GetBoolWithWeight (float Weight)
 
int32 GetIntWithWeight (const TArray< float > &Weights)
 
Elements in TArray
template<typename T >
auto & PickOne (const TArray< T > &Array)
 
template<typename T >
void Shuffle (TArray< T > &Array)
 

Static Public Member Functions

Generate Ids
static uint64 GenerateRandomId ()
 Generate a non-deterministic random id.
 

Private Attributes

std::minstd_rand Engine
 

Seed

static int32 GenerateRandomSeed ()
 Generate a non-deterministic random seed.
 
int32 GenerateSeed ()
 Generate a seed derived from previous seed.
 
void Seed (int32 InSeed)
 Seed the random engine.
 

Detailed Description

Definition at line 14 of file RandomEngine.h.

Member Function Documentation

◆ GenerateRandomId()

uint64 URandomEngine::GenerateRandomId ( )
static

Generate a non-deterministic random id.

Definition at line 16 of file RandomEngine.cpp.

References Engine.

◆ GenerateRandomSeed()

int32 URandomEngine::GenerateRandomSeed ( )
static

◆ GenerateSeed()

int32 URandomEngine::GenerateSeed ( )

Generate a seed derived from previous seed.

Definition at line 35 of file RandomEngine.cpp.

References GetUniformIntInRange().

◆ GetBernoulliDistribution()

bool URandomEngine::GetBernoulliDistribution ( float  P)
inline

Definition at line 86 of file RandomEngine.h.

◆ GetBinomialDistribution()

int32 URandomEngine::GetBinomialDistribution ( int32  T,
float  P 
)
inline

Definition at line 92 of file RandomEngine.h.

◆ GetBoolWithWeight()

bool URandomEngine::GetBoolWithWeight ( float  Weight)
inline

Definition at line 122 of file RandomEngine.h.

◆ GetExponentialDistribution()

float URandomEngine::GetExponentialDistribution ( float  Lambda)
inline

Definition at line 104 of file RandomEngine.h.

◆ GetIntWithWeight()

int32 URandomEngine::GetIntWithWeight ( const TArray< float > &  Weights)
inline

Definition at line 128 of file RandomEngine.h.

Referenced by PickARoute().

◆ GetNormalDistribution()

float URandomEngine::GetNormalDistribution ( float  Mean,
float  StandardDeviation 
)
inline

◆ GetPoissonDistribution()

int32 URandomEngine::GetPoissonDistribution ( float  Mean)
inline

Definition at line 98 of file RandomEngine.h.

◆ GetState()

uint32 URandomEngine::GetState ( ) const

The engine's state, to continue its exact sequence elsewhere (a Multi-GPU secondary's mirror of a sensor).

Definition at line 42 of file RandomEngine.cpp.

References Engine, and carla::multigpu::GetEngineState().

Referenced by AAutowareGnssSensor::GetMirrorState(), AGnssSensor::GetMirrorState(), AInertialMeasurementUnit::GetMirrorState(), ARadar::GetMirrorState(), and ARayCastSemanticLidar::GetMirrorState().

◆ GetUniformBool()

bool URandomEngine::GetUniformBool ( )
inline

Definition at line 74 of file RandomEngine.h.

◆ GetUniformFloat()

float URandomEngine::GetUniformFloat ( )
inline

◆ GetUniformFloatInRange()

float URandomEngine::GetUniformFloatInRange ( float  Minimum,
float  Maximum 
)
inline

Definition at line 62 of file RandomEngine.h.

Referenced by ARadar::SendLineTraces().

◆ GetUniformIntInRange()

int32 URandomEngine::GetUniformIntInRange ( int32  Minimum,
int32  Maximum 
)
inline

Definition at line 68 of file RandomEngine.h.

Referenced by GenerateSeed().

◆ PickOne()

template<typename T >
auto & URandomEngine::PickOne ( const TArray< T > &  Array)
inline

Definition at line 142 of file RandomEngine.h.

◆ Seed()

void URandomEngine::Seed ( int32  InSeed)
inline

◆ SetState()

void URandomEngine::SetState ( uint32  State)

Continue from State, as GetState returned it; an impossible value is ignored.

Definition at line 47 of file RandomEngine.cpp.

References Engine, carla::multigpu::SetEngineState(), and State.

Referenced by AAutowareGnssSensor::SetMirrorState(), AGnssSensor::SetMirrorState(), AInertialMeasurementUnit::SetMirrorState(), ARadar::SetMirrorState(), and ARayCastSemanticLidar::SetMirrorState().

◆ Shuffle()

template<typename T >
void URandomEngine::Shuffle ( TArray< T > &  Array)
inline

Definition at line 149 of file RandomEngine.h.

Member Data Documentation

◆ Engine

std::minstd_rand URandomEngine::Engine
private

Definition at line 166 of file RandomEngine.h.

Referenced by GenerateRandomId(), GetState(), and SetState().


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