Generate one random number within the range of 1 to 10, and another random number within the range of 100 to 499.
SELECT Int((10 – 1 + 1) * Rnd + 1) AS RandNumBetween1and10, Int((499 – 100 + 1) * Rnd + 100) AS RandNumBetween100and499; |
The Rnd function provides a random number.
Note: Without calling the Randomize() function beforehand, the Rnd function may return the same random number each time it’s called!
To generate a random integer between 0 (inclusive) and 1 (exclusive).
Rnd |
To generate a random integer within a specified range, utilize this formula:
Int((upperbound – lowerbound + 1) * Rnd + lowerbound) |
Parameter |
Description |
upperbound |
Specify the maximum permissible value for the random number. |
lowerbound |
Specify the minimum allowable value for the random number. |
WORKS IN |
From Access 2000 |