jeudi 13 janvier 2022

Looping variable RNG in a Batch file [duplicate]

I am attempting to make a simple RNG that takes two input variables to determine the number of loops as well as the range of the generated numbers in said loops. I created a file that works without the variables but I am having some issues with the Loop function and the variables. Any wrinkled Brains out there that can shed some light would be much appreciated.

@echo off 
color f0
set /p "FileName= Enter Filename (Without Extension) : "
echo @echo off >> %FileName%.txt
pause
set /p "Part= Enter TOTAL Number of vanes: "
echo %Part% Vanes total
pause
Set /p "Inspect= Enter Number of Vanes to Inspect: "
echo Out of %part% Vanes there will be %inspect% vanes randomly chosen
echo File Created!
pause
cls

set /A Range=%Part%/%inspect%
set /A Range2=%Part%/%inspect%
set /A Inc=%inspect%-%inspect%+1
set /A Bott=%Range%-%Range%+1

FOR /L %%F IN (1,1,%inspect%) DO (
    SET /A Rand_%inc%=!%RANDOM%%Inc%! %% (%range%-%Bott%+1)+%Bott%
    (echo Rand_%inc%) >>%FileName%.txt
    set /A Inc=%Inc%+1
    set /A BOTT=%range%+1
    set /A range=%range%+%range2%+1
    goto :eof
    echo %%f
    )



Aucun commentaire:

Enregistrer un commentaire