-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrandom.bat
More file actions
39 lines (31 loc) · 752 Bytes
/
Copy pathrandom.bat
File metadata and controls
39 lines (31 loc) · 752 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
:: Name: random.bat
::
:: Purpose: Generate a random integer between 0 and 32767. You can also pass
:: one parameter to set the maximum random number possible, or two parameters
:: to set the range of the random number.
::
:: Usage :
:: random.bat
:: random.bat <MAX_EXCLUSIVE>
:: random.bat <MIN_INCLUSIVE> <MAX_EXCLUSIVE>
::
:: Author: BIZZOZZERO Nicolas
@ECHO off
SETLOCAL
IF "%1" == "" GOTO :args_0
IF "%2" == "" GOTO :args_1
IF "%3" == "" GOTO :args_2
echo Error, two many parameters
GOTO :end
:args_0
ECHO %RANDOM%
GOTO :end
:args_1
SET /A RESULT = %RANDOM% %% %1
ECHO %RESULT%
GOTO :end
:args_2
SET /A RESULT = %RANDOM% %% (%2 - 1) + %1
ECHO %RESULT%
GOTO :end
:end