FRandomStream
- Module
- Core
- Header
#include "Core/FRandomStream.h"- Namespace
Mowo
Constructors
| Signature | Name | Description |
|---|---|---|
FRandomStream() noexcept | FRandomStream | Seeds from a baked constant — fine for tests / fixtures, NOT for "random enough" gameplay rolls. |
explicit FRandomStream(uint32_t seed) noexcept | FRandomStream |
Public functions
| Returns | Name | Description |
|---|---|---|
void | Initialize | Reseed in-place. |
uint32_t | GetGlobalSeed | The process's gameplay seed. |
bool | IsGlobalSeedPinned | True when the seed came from --seed=N rather than entropy. |
uint32_t | SeedFor | A seed for one named stream. |
uint32_t | SeedForInstance | A distinct seed per call, still reproducible under --seed: for objects that each own a stream (an emitter, a preview) and must not all roll the same sequence side by side. |
uint32_t | DeriveSeed | Pure form of SeedFor, for callers that carry their own base seed (a host-distributed match seed, a test comparing two seeds in one process). |
uint32_t | RandRange32 | |
float | FRand | Float in [0, 1). |
float | FRandRange | Float in [min, max]. |
int32_t | RandRange | Int in [min, max] inclusive both sides. |
bool | RandBool | |
uint64_t | GetState | Current state (for save/load). |
uint64_t | GetInc | |
void | RestoreState |
Function details
FRandomStream
FRandomStream() noexceptSeeds from a baked constant — fine for tests / fixtures, NOT for "random enough" gameplay rolls. Seed those explicitly.
FRandomStream
explicit FRandomStream(uint32_t seed) noexceptInitialize
void Initialize(uint32_t seed) noexceptReseed in-place. Wipes any rolled state.
GetGlobalSeed
static uint32_t GetGlobalSeed()The process's gameplay seed. Every stream that should differ between runs yet replay exactly under --seed=N derives from it; without the switch it comes from entropy once per process. Identity (FGuid, UUID) must never come from here — two processes sharing a seed would mint the same ids.
IsGlobalSeedPinned
static bool IsGlobalSeedPinned()True when the seed came from --seed=N rather than entropy.
SeedFor
static uint32_t SeedFor(std::string_view salt)A seed for one named stream. The salt keeps streams independent — two systems drawing from one seed would otherwise replay each other's rolls — while the global seed keeps all of them reproducible together.
SeedForInstance
static uint32_t SeedForInstance(std::string_view salt)A distinct seed per call, still reproducible under --seed: for objects that each own a stream (an emitter, a preview) and must not all roll the same sequence side by side. Replays exactly when construction order does.
DeriveSeed
static uint32_t DeriveSeed(uint32_t baseSeed, std::string_view salt) noexceptPure form of SeedFor, for callers that carry their own base seed (a host-distributed match seed, a test comparing two seeds in one process).
RandRange32
uint32_t RandRange32() noexceptFRand
float FRand() noexceptFloat in [0, 1).
FRandRange
float FRandRange(float min, float max) noexceptFloat in [min, max].
RandRange
int32_t RandRange(int32_t min, int32_t max) noexceptInt in [min, max] inclusive both sides.
RandBool
bool RandBool(float trueProbability = 0.5f) noexceptGetState
uint64_t GetState() const noexceptCurrent state (for save/load). Two streams with identical (state, inc) produce identical sequences from that point.
GetInc
uint64_t GetInc() const noexceptRestoreState
void RestoreState(uint64_t state, uint64_t inc) noexcept