.FUNCTION....: #Random - Produce A Random Number
#RANDOM returns a random number between a lowerbound number and an
More precisely, it returns a number X, where:
- lowerbound <= X <= upperbound
- if lowerbound is 3, and upperbound is 5, then #RANDOM will
randomly return 3, 4, or 5.
- if lowerbound is 999999997 and upperbound is 999999999, then #RANDOM will
randomly return 999999997, 999999998, and 999999999.
- The upperbound number is specified on the /A parm, and is required.
- The lowerbound number is specified on the /B parm, and is optional.
If omitted, it defaults to zero.
- Both upperbound and lowerbound numbers must be integers
- The lower bound cannot be less than zero.
- The upper bound must be greater than the lower bound.
- The upper bound cannot be greater than 999999999 (9 digits).
- The difference between the lower bound and the
upper bound cannot be more than 99999 (5 digits).
:: a batch file to demonstrate generation of a
:: random number between 3 and 10, and putting
:: it into an environment variable named RAND
Fdate /f#random /A10 /B3 /p"@set RAND=">junk.bat
echo Random number is %RAND%
:: use the RAND environment variable as you wish, here.