function:RAND

# Differences

This shows you the differences between two versions of the page.

 function:RAND [2015/07/13 06:03]peternlewis created function:RAND [2019/07/04 03:32] (current)peternlewis 2019/07/04 03:32 peternlewis 2015/07/13 06:03 peternlewis created 2019/07/04 03:32 peternlewis 2015/07/13 06:03 peternlewis created Line 1: Line 1: - The RAND(N) ​function ​returns random integer ​number ​from 0 to, but not including, N. + The //RAND()// functions return a random integer number. + + * RAND(N) returns ​a random integer from 0 to, but not including, N. + * RAND(A,B) returns (v9.0+) a random integer number from A to, including, B. + + In the one parameter version, N must be greater than or equal to 1. + + In the two parameter version, A must not equal B, and if B is less than A, they are implicitly swapped. + + Note: Unlike all the other variants of //RAND()// and [[function:​RANDOM|RANDOM()]],​ RAND(A,B) may return the larger number. ​ This makes RAND(1,6) return the same as a regular dice for example, a number from 1-6 inclusive, which matches what you would normally want. + + ===== See Also ===== + + ==== Functions ==== + + * [[function:​RANDOM]] + * [[:​Functions|See all Functions]]