|
Answer» hey GUYS,
I'm writing a game and I'd like to have a few random things happen.
I've used %random% to generate a number but the number is allways very simlier to tha last one.
I had intended to get a ramdom number, divided by 2 and then do a if gtr then do.... if lss than do.... but beacuse the number is allways around the 170** range.
example
test.bat
@echo off
Code: [Select]set NUM=%random% echo %num%
set /a num=%num% / 2 echo %num%
if /i "%num%" GTR "16384" (echo number low) ELSE echo number low
set num=
pause
any ideas??thing about it,
I've just grabbed the last digit as it allways changes and used that instead;
set num=%random%
set /a num=%num% / 2
set /a num=%num:~3,2%
if /i "%num%" GEQ "5" (echo number high) else echo number low
set num=
pause
job done.
Cheers ANYWAYS guys
What about this:
Set /a Number=(%Random% %%10)+1
That will generate a number between 1 and 10.arh,
That's much neater.
Cheers mate.No problem.
|