RandomFloat - Utility

From Creation Kit
Jump to: navigation, search

Member of: Utility Script

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

Syntax

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

Parameters

  • 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

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

Examples

; 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