Definition: | atom x2 = rand(atom x1) |
Description: | Return a random integer from 1 to x1, where x1 may be from 1 to the largest positive value of type integer (1073741823). |
Comments: |
This function may be applied to an atom or sq_rand() to all elements
of a sequence. The rules for
sequence operations apply.
In order to get reproducible results from this function, you should call set_rand() with a reproducible value prior to calling this. You should note that the implementation is trivial (see builtins/VM/pRand.e) and you should not assume that the results will be perfectly distributed or cryptographically secure. Many other random number generators can be found in the RDS Eu archive, let me know of any that you think should be included in the standard distribution. |
Example: |
s = rand(10) -- s might be any number between 1 and 10 inclusive. |
See Also: | set_rand |