dimanche 28 juin 2015

This code has really long loading times, how to reduce loading? (Batch)

Okay, my code is a simple batch number generator 1-10, I need a way to make the code not take 1 minute per set of code. I use this code multiple times in my script, causing outrageous loading times of up to 5 minutes.

  :ans
set /a ran=%random%
if /i %ran% GTR 10 goto :ans
if /i %ran% LSS 1 goto :ans

this code has the random feature repeated until a number 1-10 appears. This takes a really long time because there are over 31.990 other ways it could go. Please tell me how to fix this issue, with a different set of code or a edited version of the code. Thank you.




Aucun commentaire:

Enregistrer un commentaire