Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Random number formula returns same number batch

i am trying to make a random number between 1 and a variable, this variable will change each time the program runs. i am using this so far: SET /A result=%random%*%var%/32768+1

but everytime i re-run the batch file it returns the same number, do people know what is going on?

Thanks in Advance

like image 955
user2035296 Avatar asked Jul 02 '26 16:07

user2035296


1 Answers

Try this instead:

set /a result=(%random% %% %var%) + 1
like image 110
cgimusic Avatar answered Jul 05 '26 15:07

cgimusic



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!