Printer Version Table of Contents Project Home Page
.FUNCTION....: #Random - Produce A Random Number
.CATEGORY....: functions
#RANDOM returns a random number between a lowerbound number and an upperbound number.

More precisely, it returns a number X, where:

That is:


@echo off
:: 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
call junk.bat
del  junk.bat

echo Random number is %RAND%
:: use the RAND environment variable as you wish, here.

:: cleanup
set RAND=