{ }Blueprint → C++

Unreal Engine 5 · Blueprint → C++

Random Float in Unreal Engine 5 C++

The Blueprint Random Float node returns a random float between 0 and 1. In C++ call UKismetMathLibrary::RandomFloat() after including Kismet/KismetMathLibrary.h.

Blueprint node & C++ equivalent

Random Float Blueprint node and its C++ equivalent in Unreal Engine 5
The “Random Float” Blueprint node.
C++
#include "Kismet/KismetMathLibrary.h"

float Result = UKismetMathLibrary::RandomFloat();

What does the Random Float node do?

Random Float returns a uniformly random float in the range [0, 1). It is the building block for random probabilities, weighted chances, and scaling a random value into any custom range.

How to use it in C++

Include Kismet/KismetMathLibrary.h and call UKismetMathLibrary::RandomFloat(), which takes no arguments and returns a float. The engine equivalent FMath::FRand() produces the same [0, 1) range without the Kismet include.

To map the result into another range, multiply and offset it, or use UKismetMathLibrary::RandomFloatInRange(Min, Max) for a direct range result.

Frequently asked questions

How do I get a random float between 0 and 1 in UE5 C++?+

Call UKismetMathLibrary::RandomFloat() or FMath::FRand(). Both return a float in the range [0, 1).

How do I get a random float in a custom range?+

Use UKismetMathLibrary::RandomFloatInRange(Min, Max) or FMath::FRandRange(Min, Max).

Related Math nodes

View all Math nodes →