So I am trying to code the card game of BlackJack using Batch code, and I have coded a random number generator to generate the player's cards. When I try and use the random number generator it keeps on giving the same first card and then a random second card. Here is my code to generate the player's first card:
set /a val1=2
set /a val2=14
:FirstCard
call :findrannumA
echo Your first card is %rannumA%
pause >nul
goto Second Card
:findrannumA
set /a dif= ( %val2% - %val1% ) + 1
set /a Div=32767 / %dif%
set /a rannumA=%random% / %div%
set /a rannumA=%rannumA% + %val1%
if %rannumA% gtr %val2% goto findrannumA
if %rannumA% lss %val1% goto findrannumA
goto :EOF
%rannumA% is the random number, which is the number that goes with the card. (11, 12, 13, and 14 are Jack, Queen, King, and Ace.) For whatever reason, it doesn't just repeat the same answer over again. Instead, it gives one particular number between the specified limits, 2 and 14, over and over again every time you open the file, then it will change the number after a while and give another number for a while, and it keeps repeating this cycle.
Anyone know anything to help me in this situation?