Navigation
API > API/Runtime > API/Runtime/Core
Implements a thread-safe SRand based RNG.
Very bad quality in the lower bits. Don't use the modulus (%) operator.
| Name | FRandomStream |
| Type | struct |
| Header File | /Engine/Source/Runtime/Core/Public/Math/RandomStream.h |
| Include Path | #include "Math/RandomStream.h" |
Syntax
struct FRandomStream
Constructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
FRandomStream
(
FName InName |
Creates and initializes a new random stream from the specified name. | Math/RandomStream.h | |
FRandomStream
(
int32 InSeed |
Creates and initializes a new random stream from the specified seed value. | Math/RandomStream.h | |
| Default constructor.The seed should be set prior to use. | Math/RandomStream.h |
Variables
Protected
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| InitialSeed | int32 | Holds the initial seed. | Math/RandomStream.h | |
| Seed | uint32 | Holds the current seed. | Math/RandomStream.h |
Functions
Public
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
float FRand() |
Mirrors the random number API in FMath | Math/RandomStream.h | |
FVector::FReal FRandRange
(
FVector::FReal InMin, |
Helper function for rand implementations. | Math/RandomStream.h | |
void GenerateNewSeed() |
Generates a new random seed. | Math/RandomStream.h | |
int32 GetCurrentSeed() |
Gets the current seed. | Math/RandomStream.h | |
float GetFraction() |
Returns a random float number in the range [0, 1). | Math/RandomStream.h | |
int32 GetInitialSeed() |
Math/RandomStream.h | ||
FVector GetUnitVector() |
Returns a random vector of unit size. | Math/RandomStream.h | |
uint32 GetUnsignedInt() |
Returns a random number between 0 and MAXUINT. | Math/RandomStream.h | |
void Initialize
(
FName InName |
Initializes this random stream using the specified name. | Math/RandomStream.h | |
void Initialize
(
int32 InSeed |
Initializes this random stream with the specified seed value. | Math/RandomStream.h | |
int32 RandHelper
(
int32 A |
Helper function for rand implementations. | Math/RandomStream.h | |
FVector RandPointInBox
(
const FBox& Box |
Math/RandomStream.h | ||
int32 RandRange
(
int32 Min, |
Helper function for rand implementations. | Math/RandomStream.h | |
void Reset() |
Resets this random stream to the initial seed value. | Math/RandomStream.h | |
FString ToString() |
Get a textual representation of the RandomStream. | Math/RandomStream.h | |
FVector VRand() |
Returns a random vector of unit size. | Math/RandomStream.h | |
FVector VRandCone
(
FVector const& Dir, |
Returns a random unit vector, uniformly distributed, within the specified cone. | Math/RandomStream.h | |
FVector VRandCone
(
FVector const& Dir, |
Returns a random unit vector, uniformly distributed, within the specified cone. | Math/RandomStream.h |
Protected
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
void MutateSeed() |
Mutates the current seed into the next seed. | Math/RandomStream.h |