Eyeon:Script/Reference/Libraries/math/random

From VFXPedia

< Eyeon:Script | Reference | Libraries | math
Revision as of 14:01, 9 December 2006 by Peter (Talk | contribs)
(diff) ← Older revision | Current revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Contents

Math : math.random

Arguments

math.random( lower, upper )

  • lower (optional, integer)

An optional argument to determine the lower range of returned values.

  • upper (optional, integer)

An optional argument to determine the upper range of returned values.

Returns

The math.random function returns pseudo random numbers either as real numbers between 0 and 1, or as integers between the range defined in the arguments.

Remarks

The math.random function returns pseudo random numbers. It can be called in one of three ways:

Without Arguments

When the random function is called without arguments, it returns a real number between 0 and 1.

With an upper limit only

When the random function is called with a single argument, it returns an integer number between 1 and the argument. The supplied argument must be an integer, fractional values (numbers after the decimal) will be truncated.

With both upper, lower limits

When the random function is called with two arguments, the first argument represents the lower limit, and the second represents the upper limit. The returned value is still an integer number between the lower and upper limit. The supplied argument must be an integer, fractional values (numbers after the decimal) will be truncated.

You can set a seed for the random() function using the randomseed() function.

Requirements

  • eyeonScript 5.0
  • Fusion 5.0

Examples

-- generates a value between 0 and 1 math.random() -- simulates the roll of a six sided dice math.random(6) -- produces an integer between 10 and 20 math.random(10, 20)


Tips for random (edit)

EyeonTips:Script/Reference/Libraries/math/random