RandomFloat - Utility

Revision as of 14:50, 26 October 2011 by imported>Plplecuyer
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Member of: Utility Script

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

SyntaxEdit

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

ParametersEdit

  • 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 ValueEdit

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

ExamplesEdit

; 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 AlsoEdit