|
Answer» Is is possible in DOS to generate a NUMBER in a given range? Thank youAre you using the console of WXP or DOS 6.X ?
If you're running Windows, you can do:
set /a %RANDOM% % 4 + 1
To generate a number between 1 and 4.I'm using the console in Win2k and I get a "missing operator" from your CODE. Any ideas?The command Carlos gave should work if you paste it directly on the command line. If you want to use it in a batch FILE, double up on the percent sign before the 4
Command line:Code: [SELECT]set /a %RANDOM% % 4 + 1 Batch file:Code: [Select]@ECHO off set /a rnd=%RANDOM% %% 4 + 1 echo %rnd%Perfect, thank you very much.
|