With Instructables you can share what you make with the world, and tap into an ever-growing community of creative experts.
We have a be nice comment policy. Please be positive and constructive.
We noticed you attached photosto your comment.
OK so batch is not great at random numbers
the best and easiest way in my opinion is to do this set /a var=%random% %% max + min
however if you try to set your min to something greater than zero it will ignore the maximum number
to avoid this you can put it in a loop like this
set /a var=%random% %% 9 + 5
if %var% gtr 9 go to start
So I used the set /a number=%random% %% 40 + 5 but basically if you don't use 1 as the min number the number will go beyond the max for example using Min1 Max5 does from 1 to 5 but using min5 max10 it goes like 7,9 then crosses the max number... The language of BAT isn't the best..
:: pick a random number between say 0 to 19 or 1 to 20
:: take the hundredths of a second 0 to 99 from current timeset eddie=%time:~-2%
:: modulus doesn't like numbers like 08, it thinks it's octal, so knock off the zero set first=%eddie:~0,1% if %first%==0 set eddie=%eddie:~1,1%
:: make number modulus 20 to keep range 0 to 19 , so 99 mod 20 = 19:: if you want 1 to 20 change the modulus to 19 and add 1 to eddieset /a eddie=(%eddie%%%20)echo number=%eddie%
random numbers easy
take the millseconds off %time% 0 to 99
then xor to get in your range
echo. space space space word space space word
echo word word
the spaces don't show why ?
how to cure it ?
Batch Matrix Prank
Variant of Batch programms made by me.
how to do batch
Big Helpfull Batch File Menu
Gravity Falls Drummer
Hidden Virus & Game!
MS-DOS batch fun
How to Create A Matrix Styled CMD Effect Plus Live ECG Monitor
Batch file Website menu
How to Make an Operating System Batch
Posted:Oct 3, 2009
Let your inbox help you discover our best projects, classes, and contests. Instructables will help you learn how to make anything!
© 2016 Autodesk, Inc.