UKismetMathLibrary::SetRandomStreamSeed
#include "Kismet/KismetMathLibrary.h"
Access: public
Specifiers: staticUFUNCTIONBlueprintCallable
Description
Sets a random stream's seed to a specific known value, making its subsequent sequence of random draws fully deterministic and reproducible.
Caveats & Gotchas
- • This is the function to use for reproducible randomness (e.g. matching a random level layout across a save/load or a networked match) — SeedRandomStream instead produces a non-deterministic seed.
- • Any values already drawn from the stream before calling this are discarded; the sequence restarts from NewSeed.
Signature
static void SetRandomStreamSeed(UPARAM(ref) FRandomStream& Stream, int32 NewSeed) Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| Stream | FRandomStream& | The random stream to reseed. | — |
| NewSeed | int32 | The specific seed value to initialize the stream with. | — |
Return Type
void Example
Seed a stream from a save game value C++
UKismetMathLibrary::SetRandomStreamSeed(WorldGenStream, SaveGame->WorldSeed); Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?