CARLA
Private Attributes | List of all members
URandomEngine Class Reference

#include <RandomEngine.h>

+ Inheritance diagram for URandomEngine:
+ Collaboration diagram for URandomEngine:

Public Member Functions

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. More...
 

Private Attributes

std::minstd_rand Engine
 

Seed

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

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 12 of file RandomEngine.cpp.

References Engine.

◆ GenerateRandomSeed()

int32 URandomEngine::GenerateRandomSeed ( )
static

Generate a non-deterministic random seed.

Definition at line 22 of file RandomEngine.cpp.

Referenced by AWheeledVehicleAIController::AWheeledVehicleAIController(), AActorWithRandomEngine::OnConstruction(), UActorBlueprintFunctionLibrary::SetGnss(), UActorBlueprintFunctionLibrary::SetIMU(), and UActorBlueprintFunctionLibrary::SetRadar().

+ Here is the caller graph for this function:

◆ GenerateSeed()

int32 URandomEngine::GenerateSeed ( )

Generate a seed derived from previous seed.

Definition at line 31 of file RandomEngine.cpp.

References GetUniformIntInRange().

+ Here is the call graph for this function:

◆ 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().

+ Here is the caller graph for this function:

◆ GetNormalDistribution()

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

Definition at line 110 of file RandomEngine.h.

Referenced by AInertialMeasurementUnit::ComputeAccelerometerNoise(), AInertialMeasurementUnit::ComputeGyroscopeNoise(), AGnssSensor::PostPhysTick(), ARayCastLidar::PostprocessDetection(), and ADVSCamera::Simulation().

+ Here is the caller graph for this function:

◆ GetPoissonDistribution()

int32 URandomEngine::GetPoissonDistribution ( float  Mean)
inline

Definition at line 98 of file RandomEngine.h.

◆ GetUniformBool()

bool URandomEngine::GetUniformBool ( )
inline

Definition at line 74 of file RandomEngine.h.

◆ GetUniformFloat()

float URandomEngine::GetUniformFloat ( )
inline

Definition at line 56 of file RandomEngine.h.

Referenced by ARayCastLidar::PostprocessDetection(), ARayCastLidar::PreprocessRays(), and ARadar::SendLineTraces().

+ Here is the caller graph for this function:

◆ GetUniformFloatInRange()

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

Definition at line 62 of file RandomEngine.h.

Referenced by ARadar::SendLineTraces().

+ Here is the caller graph for this function:

◆ GetUniformIntInRange()

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

Definition at line 68 of file RandomEngine.h.

Referenced by GenerateSeed().

+ Here is the caller graph for this function:

◆ 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

Seed the random engine.

Definition at line 44 of file RandomEngine.h.

Referenced by AWheeledVehicleAIController::AWheeledVehicleAIController(), AActorWithRandomEngine::GetSeed(), AActorWithRandomEngine::OnConstruction(), AActorWithRandomEngine::SetSeed(), and ASensor::SetSeed().

+ Here is the caller graph for this function:

◆ 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 158 of file RandomEngine.h.

Referenced by GenerateRandomId().


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