draw(X;Y)
Returns a random number using a given seed.
Syntax
draw(X;Y)
Input
Argument | Type | Description |
---|---|---|
X |
integer | A scalar value
|
Y |
integer | A scalar value If
|
Return Value
A random number is drawn, with replacement, for each row. If Y
is 0, then
random decimal numbers between 0.0 and 1.0 are drawn; otherwise, random integers between 0
and Y
-1 are drawn.
If the current table has only one segment or is a tabulation, then Y
may
also be negative; in this case |Y
| must be greater than or equal to the
number of selected rows, and random integers between 0 and |Y
|-1 are drawn
without replacement.
If X
or Y
is N/A, an error is returned.
Note:
draw(X;Y)
will not work correctly when selections or links with
expansion (expand="1"
) are used. In such cases,
draw_(X;Y)
should be used instead. See draw_(X;Y)
as well as <sel>
and <link>
for
more information.Example
<base table="default.lonely"/> <colord hide="c1"/> <willbe name="int_zero" value="draw(4892;0)"/> <willbe name="int_pos" value="draw(4892;7)"/> <willbe name="int_neg" value="draw(4892;-617)"/>