RealDocs

UKismetMathLibrary::MakeRandomStream

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

Description

Creates an FRandomStream initialized with a specific seed. The stream is fully deterministic — the same seed always produces the same sequence of random numbers, making it suitable for reproducible procedural generation.

Caveats & Gotchas

  • Two FRandomStream instances with the same seed run in perfect lockstep and produce identical sequences. If you need independent random behaviour in multiple systems, use different seeds derived from distinct sources (e.g. ActorID ^ FrameNumber).
  • Seed 0 is valid but generates a fixed predictable sequence that feels non-random to players. Avoid using it as a default; prefer initializing with a value like FMath::Rand() at startup when reproducibility is not required.

Signature

static ENGINE_API FRandomStream MakeRandomStream(int32 InitialSeed);

Parameters

Name Type Description Default
InitialSeed int32 The seed value that determines the random sequence produced by this stream.

Return Type

FRandomStream

Example

Create a seeded stream for reproducible level generation C++
int32 LevelSeed = 42;
FRandomStream Stream = UKismetMathLibrary::MakeRandomStream(LevelSeed);
float SpawnChance = Stream.FRand(); // always same value for seed 42

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.