UKismetMathLibrary::RandomIntegerInRangeFromStream
#include "Kismet/KismetMathLibrary.h"
Access: public
Specifiers: staticUFUNCTIONBlueprintPure
Description
Returns a random integer between Min and Max inclusive, drawn from a specific FRandomStream so results are reproducible given the same seed and call order.
Caveats & Gotchas
- • Unlike RandomIntegerFromStream, both bounds are inclusive here — off-by-one errors are common when porting code between the two functions.
- • If Min > Max the range computation goes negative and results become unreliable; the function does not validate ordering.
Signature
static int32 RandomIntegerInRangeFromStream(const FRandomStream& Stream, int32 Min, int32 Max) Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| Stream | const FRandomStream& | The random stream to draw from. | — |
| Min | int32 | Inclusive lower bound. | — |
| Max | int32 | Inclusive upper bound. | — |
Return Type
int32 Example
Reproducible damage roll C++
FRandomStream CombatStream(EncounterSeed);
int32 Damage = UKismetMathLibrary::RandomIntegerInRangeFromStream(CombatStream, 10, 20); Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?