RandomFloat - Utility

From the Fallout4 CreationKit Wiki
Jump to navigation Jump to search

Member of: Utility Script

Generates a random floating point number between the minimum and maximum values (inclusive).

Syntax[edit | edit source]

float Function RandomFloat(float afMin = 0.0, float afMax = 1.0) native global

Parameters[edit | edit source]

  • afMin: The minimum value for the random floating point number.
    • Default: 0.0
  • afMax: The maximum value for the random floating point number.
    • Default: 1.0

Return Value[edit | edit source]

A random floating point number between afMin and afMax (inclusive)

Examples[edit | edit source]

; Get a random number between 0 and 1
float random = Utility.RandomFloat()


; Get a random number between -1 and 1
float random = Utility.RandomFloat(-1.0, 1.0)

See Also[edit | edit source]