You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Current »

Generates a random value.

Syntax

Result = SRP_Math("RANDOM", Min, Max, DecimalPlaces, ScientificNotation)

Returns

A random number between the given Min and Max.

Remarks

The RANDOM operation generates a random number. Value1 may contain a minimum value, in which case the random number will not be less than Min. Value2 may contain a maximum value in which case the random number will not be more than Max. If you omit these values, then they default to 0.0 and 1.0 respectively.

You can specify RAND for short.

Example

// Generate a random decimal number between 0.0 and 1.0
RandomNumber1 = SRP_Math("RANDOM") 
// Generate a random decimal number between 0.0 and 1.0, abbreviating the operation name
RandomNumber2 = SRP_Math("RAND")
// Generate a random number between 1 and 100, rounded to the nearest integer
RandomNumber3 = SRP_Math("RANDOM", 1, 100, 0)
// Generate a random number between 100 and 100,000, truncating the decimal
RandomNumber4 = SRP_Math("INT", SRP_Math("RANDOM", 100, 100000))
  • No labels