RealDocs

UKismetMathLibrary::BreakRandomStream

function Engine Blueprint Since 4.0
#include "Kismet/KismetMathLibrary.h"
Access: public Specifiers: staticBlueprintPureUFUNCTION

Description

Extracts the initial seed value from an FRandomStream. Use this to serialize a stream's identity for save games or replicated state without storing the full stream object.

Caveats & Gotchas

  • Only the **initial seed** is returned, not the current draw position. If the stream has already produced values, reconstructing it from the seed via MakeRandomStream restarts the sequence from the beginning — any consumed values are effectively replayed.
  • FRandomStream internally uses a separate current-seed that advances with each draw. BreakRandomStream does not expose this current state, so it is impossible to resume mid-stream from the broken value alone.

Signature

static ENGINE_API void BreakRandomStream(const FRandomStream& InRandomStream, int32& InitialSeed);

Parameters

Name Type Description Default
InRandomStream const FRandomStream& The random stream to decompose.
InitialSeed int32& Receives the initial seed the stream was constructed with.

Return Type

void

Example

Save and restore a procedural stream across sessions C++
// Save
int32 SavedSeed;
UKismetMathLibrary::BreakRandomStream(ProceduralStream, SavedSeed);
SaveGame->StoredSeed = SavedSeed;

// Restore
FRandomStream RestoredStream = UKismetMathLibrary::MakeRandomStream(SaveGame->StoredSeed);

Version History

Introduced in: 4.0

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.