Unreal Engine 5 · Blueprint → C++
Random Integer in Range in Unreal Engine 5 C++
The Blueprint Random Integer in Range node returns a random whole number between Min and Max inclusive. In C++ call UKismetMathLibrary::RandomIntegerInRange(Min, Max) after including Kismet/KismetMathLibrary.h.
Blueprint node & C++ equivalent

#include "Kismet/KismetMathLibrary.h"
int32 Min;
int32 Max;
int32 Result = UKismetMathLibrary::RandomIntegerInRange(Min, Max);What does the Random Integer in Range node do?
Random Integer in Range returns a uniformly random int32 between Min and Max, with both bounds inclusive. Unlike Random Integer, which always starts at 0, this lets you pick any lower bound, including negative values.
How to use it in C++
Include Kismet/KismetMathLibrary.h and call UKismetMathLibrary::RandomIntegerInRange(Min, Max). The result can equal either Min or Max. The engine function FMath::RandRange(Min, Max) behaves identically and needs no Kismet include.
For example, RandomIntegerInRange(1, 6) simulates a six-sided die because both 1 and 6 are possible outcomes.
Frequently asked questions
Is Max inclusive in RandomIntegerInRange?+
Yes. UKismetMathLibrary::RandomIntegerInRange(Min, Max) can return both Min and Max, making the range fully inclusive.
What is the difference between RandomInteger and RandomIntegerInRange?+
RandomInteger(Max) returns [0, Max), while RandomIntegerInRange(Min, Max) returns an inclusive range with a configurable lower bound.