Need help with a .bat Tags: Windows XP Last response: August 10, 2011 4:04 PM in Windows XP Share xGhost4000x August 10, 2011 2:06:05 PM Hello, I need to make a program which draws a random number 1-3 twice, but doesn't allow for duplicates. Here is what I have: Quote:echo off cls :begin~! set /a count=count+1 set /a pool=3*%random%/32768+1 echo %pool% if %count% == 2 goto !stop! goto begin~! exit :!stop! set /a count=nul pause goto begin~! As you can see that will pick 2 numbers out of a random num 1- 3, however currently there is nothing to stop it from drawing duplicates. Is there anyway to stop duplicates from being echo'ed ? Thanks! More about : bat Emerald August 10, 2011 4:03:28 PM can you use another variable that you assign the first number to and compare it to the second one drawn. if the two numbers are the same reduce count by one to run the randomization again if the second number is different display and exit AntiZig August 10, 2011 4:04:40 PM add an if statement that checks if its a duplicate, if it is go to step for number generation Can't find your answer ? Ask ! Publish Related resources I need help mofiying a . BAT file Forum Need help in writing a . bat file. Forum Need help writing a simple . bat file Forum [SOLVED]Custom . bat file help UPDATED Forum Need help writing a . Bat file Forum How to ask for help Forum BAT file coding help , please Forum Need write results from 2 seperate files to one log file via . bat Forum need help writing a BAT file Forum I need to restore a deleted BAT file extension association... Forum Help writing a bat file Forum Create a . bat file to append a date to several files Forum ApplesRebelMac help to run from server. bat Forum I Delete Volume my harddish partition from win7 disk management. bat I can not c Forum Help ! Can I install GF2 Mx200 on my P6 bat Me M/b Forum Bat -files of a distributed programm don't allow arguments(directories) Forum Running . bat files minimized from scheduler Forum Getting past administrative password Forum Need help with my pc and registry keys.... Forum HELP!! I need help with sending out mail. PLEASE HELP! 2nd.. Forum More resources Read discussions in other Windows XP categories Configuration Customization Drivers Security Video !