UKismetMathLibrary::RandomFloatInRangeFromStream
#include "Kismet/KismetMathLibrary.h"
Access: public
Specifiers: staticUFUNCTIONBlueprintPure
Description
Returns a random float between Min and Max, drawn from a specific FRandomStream so it can be reproduced given the same seed and call order.
Caveats & Gotchas
- • If Min > Max the function still evaluates Min + (Max - Min) * Fraction, which produces a value outside the intended range rather than an error — swap the arguments yourself if order isn't guaranteed.
- • Max is technically reachable only in the limit; like other UE float RNG functions the practical upper bound is just under Max.
Signature
static float RandomFloatInRangeFromStream(const FRandomStream& Stream, float Min, float Max) Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| Stream | const FRandomStream& | The random stream to draw from. | — |
| Min | float | Lower bound of the range. | — |
| Max | float | Upper bound of the range. | — |
Return Type
float Example
Deterministic spawn delay C++
FRandomStream SpawnStream(WaveSeed);
float Delay = UKismetMathLibrary::RandomFloatInRangeFromStream(SpawnStream, 0.5f, 2.0f); Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?