SecretLanguage Posted February 6, 2013 Posted February 6, 2013 This is a very nice script thank you! i just have one question? how does it Randomize without Repetition once you shut the program down or does it?, I would like to add one column and enable a right click option to select entire column for copy and paste with mouse any tips on getting this fabulous program to create a log and store to working directory? I randomly thank you expandcollapse popup#include <Array.au3> Local $iNumbers Local $iDigits = 4 Local $t = TimerInit() For $n = 0 To 1000 _RandomEx($iNumbers, $iDigits); Randomize without Repetition Next ConsoleWrite('Timer:' & TimerDiff($t) & @CR) _ArrayDisplay($iNumbers, 'RandomEx | Phoenix XL [' & @ScriptName & ']') Func _RandomEx(ByRef $aNumbers, $nDigits = 5);Converted from Recursive to Iterative ;All the Possible Numbers have been added return -1 and set @error If UBound($aNumbers) >= ((10 ^ $nDigits) - 1) - (10 ^ ($nDigits - 1)) + 1 Then Return SetError(1, 0, -1) Local $vTemp, $nChk = 0 While 1 $vTemp = Random(10 ^ ($nDigits - 1), (10 ^ $nDigits) - 1, 1) _ArraySearch($aNumbers, $vTemp) If @error Or $nChk >= (10 ^ ($nDigits/2) ) - 1 Then ExitLoop $nChk += 1 WEnd If $nChk >= (10 ^ $nDigits) - 1 Then $vTemp = _ProbabilityCheck($aNumbers, $nDigits) Switch IsArray($aNumbers) Case 0 ;Make it an Array Local $n[1] = [$vTemp] $aNumbers = $n Case 1 _ArrayAdd($aNumbers, $vTemp) EndSwitch Return $vTemp EndFunc ;==>_RandomEx Func _ProbabilityCheck(ByRef $aNumbers, $nDigits) For $n = 10 ^ ($nDigits - 1) To (10 ^ $nDigits) - 1 _ArraySearch($aNumbers, $n) If @error Then _ArrayAdd($aNumbers,$n) Return $n; EndIf Next Return -1 EndFunc ;==>_ProbabilityCheck
kylomas Posted February 6, 2013 Posted February 6, 2013 SL, See _FileWriteFromArray in the help file kylomas Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill
SecretLanguage Posted February 28, 2013 Author Posted February 28, 2013 Im trying to create a random number generator that i can use to scan against the DNC and upload ok to call #'s into a call plan. The only issue im having with the script at this time is the ability to copy more than one cell so i can paste a 1000 or so numbers for scanning. I don't know where to start searching for documentation on this or if someone uses a random generator for this purpose and has better script feel free to post thanks
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now