UKismetMathLibrary::RandomFloatFromStream
#include "Kismet/KismetMathLibrary.h"
Access: public
Specifiers: staticUFUNCTIONBlueprintPure
Description
Returns a random float in the range [0, 1), drawn from a specific FRandomStream so it can be reproduced given the same seed.
Caveats & Gotchas
- • The range is half-open — 1.0 itself is never returned, only values up to just below it.
- • Internally this is FRandomStream::GetFraction(), so it shares the same distribution and precision characteristics as other stream float draws (RandomFloatInRangeFromStream, etc.).
Signature
static float RandomFloatFromStream(const FRandomStream& Stream) Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| Stream | const FRandomStream& | The random stream to draw from. | — |
Return Type
float Example
Deterministic percentage check C++
FRandomStream DropStream(Seed);
if (UKismetMathLibrary::RandomFloatFromStream(DropStream) < 0.1f)
{
SpawnRareDrop();
} Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?