Functions

randomRange

Supported By

Syntax

[the] randomRange of ( start , end )

randomRange ( start , end )

Start and end yield integers.

Description

The randomRange function returns a random integer between start and end, inclusive. If end is less than start, the randomRange function always returns start.

Script

The following example draws 10 unique 3-digit random numbers:

on drawRandom
  put empty into randomList
  repeat until the number of items in randomList is 10
    get randomRange(100, 999)
    if (the itemdelimiter & it & the itemdelimiter) is not in ¬
        (the itemdelimiter & randomList & the itemdelimiter) then
      put it & the itemdelimiter after randomList
    end if
  end repeat
  delete last char of randomList
  put randomList
end drawRandom

See Also

random, randomDecimal