Contents | Index | < Browse | Browse >
Random number generator
$$RAND.xxx
Will supply you a random number from 0 to "xxx".
ex:
> $$Rand.100
- will give you a random number from 0 to 100.
Note that if you wanted a range of 1-100, you would have to do
> x = $($$rand.99 + 1)
You can also use a variable as the last part. This must be a
simple variable - i.e. no variable paths, vars within vars etc.
Ex:
> var = 100
> number = $$RAND.$var
The function used to generate the number is SAS's drand48() which
generates the number using a linear congruential algorithm and 48bit
arithmetic... I don't know what it means, but it sure sounds good :)