engine
 
载入中...
搜索中...
未找到
Public 成员函数 | Protected 成员函数 | 所有成员列表
FRandomStream结构体 参考

Implements a thread-safe SRand based RNG. 更多...

#include <RandomStream.h>

Public 成员函数

CORE_API bool ExportTextItem (FString &ValueStr, FRandomStream const &DefaultValue, class UObject *Parent, int32 PortFlags, class UObject *ExportRootScope) const
 Exports the RandomStreams value to a string. 更多...
 
FORCEINLINE float FRand () const
 Mirrors the random number API in FMath 更多...
 
 FRandomStream ()
 Default constructor. 更多...
 
 FRandomStream (FName InName)
 Creates and initializes a new random stream from the specified name. 更多...
 
 FRandomStream (int32 InSeed)
 Creates and initializes a new random stream from the specified seed value. 更多...
 
FORCEINLINE float FRandRange (float InMin, float InMax) const
 Helper function for rand implementations. 更多...
 
void GenerateNewSeed ()
 Generates a new random seed.
 
int32 GetCurrentSeed () const
 Gets the current seed. 更多...
 
float GetFraction () const
 Returns a random float number in the range [0, 1). 更多...
 
FVector GetUnitVector () const
 Returns a random vector of unit size. 更多...
 
uint32 GetUnsignedInt () const
 Returns a random number between 0 and MAXUINT. 更多...
 
void Initialize (FName InName)
 Initializes this random stream using the specified name. 更多...
 
void Initialize (int32 InSeed)
 Initializes this random stream with the specified seed value. 更多...
 
FORCEINLINE int32 RandHelper (int32 A) const
 Helper function for rand implementations. 更多...
 
FORCEINLINE int32 RandRange (int32 Min, int32 Max) const
 Helper function for rand implementations. 更多...
 
void Reset () const
 Resets this random stream to the initial seed value.
 
FString ToString () const
 Get a textual representation of the RandomStream. 更多...
 
FORCEINLINE FVector VRand () const
 Returns a random vector of unit size. 更多...
 
FORCEINLINE FVector VRandCone (FVector const &Dir, float ConeHalfAngleRad) const
 Returns a random unit vector, uniformly distributed, within the specified cone. 更多...
 
FORCEINLINE FVector VRandCone (FVector const &Dir, float HorizontalConeHalfAngleRad, float VerticalConeHalfAngleRad) const
 Returns a random unit vector, uniformly distributed, within the specified cone. 更多...
 

Protected 成员函数

void MutateSeed () const
 Mutates the current seed into the next seed.
 

详细描述

Implements a thread-safe SRand based RNG.

Very bad quality in the lower bits. Don't use the modulus (%) operator.

构造及析构函数说明

◆ FRandomStream() [1/3]

FRandomStream::FRandomStream ( )
inline

Default constructor.

The seed should be set prior to use.

◆ FRandomStream() [2/3]

FRandomStream::FRandomStream ( int32  InSeed)
inline

Creates and initializes a new random stream from the specified seed value.

参数
InSeedThe seed value.

◆ FRandomStream() [3/3]

FRandomStream::FRandomStream ( FName  InName)
inline

Creates and initializes a new random stream from the specified name.

注解
If NAME_None is provided, the stream will be seeded using the current time.
参数
InNameThe name value from which the stream will be initialized.

成员函数说明

◆ ExportTextItem()

CORE_API bool FRandomStream::ExportTextItem ( FString &  ValueStr,
FRandomStream const &  DefaultValue,
class UObject *  Parent,
int32  PortFlags,
class UObject *  ExportRootScope 
) const

Exports the RandomStreams value to a string.

参数
ValueStrWill hold the string value.
DefaultValueThe default value.
ParentNot used.
PortFlagsNot used.
ExportRootScopeNot used.
返回
true on success, false otherwise.
参见
ImportTextItem

◆ FRand()

FORCEINLINE float FRandomStream::FRand ( ) const
inline

Mirrors the random number API in FMath

返回
Random number.

◆ FRandRange()

FORCEINLINE float FRandomStream::FRandRange ( float  InMin,
float  InMax 
) const
inline

Helper function for rand implementations.

返回
A random number >= Min and <= Max

◆ GetCurrentSeed()

int32 FRandomStream::GetCurrentSeed ( ) const
inline

Gets the current seed.

返回
Current seed.

◆ GetFraction()

float FRandomStream::GetFraction ( ) const
inline

Returns a random float number in the range [0, 1).

返回
Random number.

◆ GetUnitVector()

FVector FRandomStream::GetUnitVector ( ) const
inline

Returns a random vector of unit size.

返回
Random unit vector.

◆ GetUnsignedInt()

uint32 FRandomStream::GetUnsignedInt ( ) const
inline

Returns a random number between 0 and MAXUINT.

返回
Random number.

◆ Initialize() [1/2]

void FRandomStream::Initialize ( FName  InName)
inline

Initializes this random stream using the specified name.

注解
If NAME_None is provided, the stream will be seeded using the current time.
参数
InNameThe name value from which the stream will be initialized.

◆ Initialize() [2/2]

void FRandomStream::Initialize ( int32  InSeed)
inline

Initializes this random stream with the specified seed value.

参数
InSeedThe seed value.

◆ RandHelper()

FORCEINLINE int32 FRandomStream::RandHelper ( int32  A) const
inline

Helper function for rand implementations.

返回
A random number in [0..A)

◆ RandRange()

FORCEINLINE int32 FRandomStream::RandRange ( int32  Min,
int32  Max 
) const
inline

Helper function for rand implementations.

返回
A random number >= Min and <= Max

◆ ToString()

FString FRandomStream::ToString ( ) const
inline

Get a textual representation of the RandomStream.

返回
Text describing the RandomStream.

◆ VRand()

FORCEINLINE FVector FRandomStream::VRand ( ) const
inline

Returns a random vector of unit size.

返回
Random unit vector.

◆ VRandCone() [1/2]

FORCEINLINE FVector FRandomStream::VRandCone ( FVector const &  Dir,
float  ConeHalfAngleRad 
) const
inline

Returns a random unit vector, uniformly distributed, within the specified cone.

参数
DirThe center direction of the cone
ConeHalfAngleRadHalf-angle of cone, in radians.
返回
Normalized vector within the specified cone.

◆ VRandCone() [2/2]

FORCEINLINE FVector FRandomStream::VRandCone ( FVector const &  Dir,
float  HorizontalConeHalfAngleRad,
float  VerticalConeHalfAngleRad 
) const
inline

Returns a random unit vector, uniformly distributed, within the specified cone.

参数
DirThe center direction of the cone
HorizontalConeHalfAngleRadHorizontal half-angle of cone, in radians.
VerticalConeHalfAngleRadVertical half-angle of cone, in radians.
返回
Normalized vector within the specified cone.

该结构体的文档由以下文件生成: