UKismetMathLibrary::RandomInteger64InRange
#include "Kismet/KismetMathLibrary.h"
Access: public
Specifiers: staticUFUNCTIONBlueprintPure
Description
Returns a uniformly distributed random int64 between Min and Max, inclusive on both ends. Use when you need a closed range rather than a half-open one.
Caveats & Gotchas
- • Marked NotBlueprintThreadSafe — do not call from async Blueprint tasks or background worker threads. Use a FRandomStream instance for deterministic or thread-local randomness.
- • If Min > Max, the result is undefined. Always ensure the bounds are ordered correctly; swap them if they come from user-controlled data.
Signature
static UE_INL_API int64 RandomInteger64InRange(int64 Min, int64 Max); Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| Min | int64 | Inclusive lower bound. | — |
| Max | int64 | Inclusive upper bound. | — |
Return Type
int64 Example
Generate a random Unix timestamp within a date window C++
int64 StartEpoch = 1700000000LL; // ~Nov 2023
int64 EndEpoch = 1800000000LL; // ~Jan 2027
int64 RandomTime = UKismetMathLibrary::RandomInteger64InRange(StartEpoch, EndEpoch); Tags
Version History
Introduced in: unknown
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?