UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
FWeightedRandomSampler Struct Referenceabstract

#include <WeightedRandomSampler.h>

+ Inheritance diagram for FWeightedRandomSampler:

Public Member Functions

 DECLARE_TYPE_LAYOUT (FWeightedRandomSampler, Abstract)
 
ENGINE_API FWeightedRandomSampler ()
 
virtual ENGINE_API ~FWeightedRandomSampler ()
 
int32 GetEntryIndex (float R0, float R1) const
 
float GetTotalWeight () const
 
virtual ENGINE_API void Initialize ()
 
virtual ENGINE_API void Serialize (FArchive &Ar)
 
int32 GetNumEntries () const
 
TArrayView< const floatGetProb () const
 
TArrayView< const int32GetAlias () const
 

Protected Member Functions

virtual float GetWeights (TArray< float > &OutWeights)=0
 
 LAYOUT_FIELD (TMemoryImageArray< float >, Prob)
 
 LAYOUT_FIELD (TMemoryImageArray< int32 >, Alias)
 
 LAYOUT_FIELD (float, TotalWeight)
 

Constructor & Destructor Documentation

◆ FWeightedRandomSampler()

FWeightedRandomSampler::FWeightedRandomSampler ( )

◆ ~FWeightedRandomSampler()

FWeightedRandomSampler::~FWeightedRandomSampler ( )
virtualdefault

Member Function Documentation

◆ DECLARE_TYPE_LAYOUT()

FWeightedRandomSampler::DECLARE_TYPE_LAYOUT ( FWeightedRandomSampler  ,
Abstract   
)

◆ GetAlias()

TArrayView< const int32 > FWeightedRandomSampler::GetAlias ( ) const
inline

◆ GetEntryIndex()

int32 FWeightedRandomSampler::GetEntryIndex ( float  R0,
float  R1 
) const
inline

Takes two random values (0...1) and returns the corresponding element index.

◆ GetNumEntries()

int32 FWeightedRandomSampler::GetNumEntries ( ) const
inline

◆ GetProb()

TArrayView< const float > FWeightedRandomSampler::GetProb ( ) const
inline

◆ GetTotalWeight()

float FWeightedRandomSampler::GetTotalWeight ( ) const
inline

◆ GetWeights()

virtual float FWeightedRandomSampler::GetWeights ( TArray< float > &  OutWeights)
protectedpure virtual

◆ Initialize()

void FWeightedRandomSampler::Initialize ( )
virtual

◆ LAYOUT_FIELD() [1/3]

FWeightedRandomSampler::LAYOUT_FIELD ( float  ,
TotalWeight   
)
protected

◆ LAYOUT_FIELD() [2/3]

FWeightedRandomSampler::LAYOUT_FIELD ( TMemoryImageArray< float ,
Prob   
)
protected

◆ LAYOUT_FIELD() [3/3]

FWeightedRandomSampler::LAYOUT_FIELD ( TMemoryImageArray< int32 ,
Alias   
)
protected

◆ Serialize()

void FWeightedRandomSampler::Serialize ( FArchive Ar)
virtual

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