RealDocs

UKismetMathLibrary::RandomFloatInRange

function Engine Blueprint Since 4.0
#include "Kismet/KismetMathLibrary.h"
Access: public Specifiers: staticUFUNCTIONBlueprintPure

Description

Returns a random float uniformly distributed between Min and Max. Both endpoints are inclusive.

Caveats & Gotchas

  • Marked NotBlueprintThreadSafe — do not call from async Blueprint nodes or worker threads; it shares global state with the game thread random stream.
  • If Min > Max the function still returns a value (it will be in [Max, Min]), but this is a logic error that can produce silent bugs in damage or animation systems — ensure Min <= Max at the call site.

Signature

static UE_INL_API double RandomFloatInRange(double Min, double Max);

Parameters

Name Type Description Default
Min double Lower bound of the range (inclusive).
Max double Upper bound of the range (inclusive).

Return Type

double

Example

Random damage in a range C++
float Damage = (float)UKismetMathLibrary::RandomFloatInRange(10.0, 25.0);
ApplyDamage(Target, Damage, ...);

Version History

Introduced in: 4.0

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.