- arrays of real may be created by coercing a standard AppleScript list of real numbers with as array of real. Conversely you make an array of real into a list of real using as list of real.
set a to {1.0, 2.0, 3.0} as array of real
class of a
-- array of real
class of (a as list of real)
-- list
The coercion also works on lists of strings.
set a to {"1", "2", "3"} as array of real
-
To create an array of real from scratch, use createarray.
set a to createarray 3
a as list of real
-- {0.0, 1.0, 2.0}
set a to createarray 101 range {0.0, 1.0}
a as list of real
-- {0.0, 0.01, ..., 1.0}
-
To create a random array of real, use randomarray.
set a to randomarray 3 range {-1.0, 1.0}
a as list of real
-- {-0.273627072573, 0.7373893857, 0.359039396048}
|