I wrote a little .bat file, hoping to be able to create a matrix-like (0 and 1) output.
The problem is, that it is pretty slow, it takes nearly two seconds to fill one line.
Is there something I can do to get it run faster?
Matrix.bat:
@echo off
color 02
:start
if %random% LSS 16384 (
echo|set /p=1
) else (
echo|set /p=0
)
goto start
echo is very slow. So build your line without echoing the single chars, then echo the whole line at once.
Another trick: set /a "l=!random! &1"
uses the last Bit from !random!
only (so it gives either 0
or 1
). This is quicker than processing Integer.
@echo off
setlocal ENABLEDELAYEDEXPANSION
:start
set line=
for /L %%i in (1,1,80) do (
set /a "l=!random! &1"
set line=!line!!l!
)
echo !line!
)
goto start