Deye Posted August 5, 2022 Share Posted August 5, 2022 (edited) In what circumstance the array will not grow returning the same count of elements (ALT+w) to fire it up perhaps using $sda.Exists wrongly expandcollapse popup#include <Array.au3> HotKeySet("!w", "_add") HotKeySet("{ESC}", "Terminate") Local $s For $i = 1 To 1010 $s &= Number($i + 1, 1) & "|" Next Global $aArray = StringSplit(StringTrimRight($s, 1), "|"), $icount = 100 ,$sda = ObjCreate("Scripting.Dictionary") $sda.Item(0) While 1 Sleep(10) WEnd Func _add() Local $x Do $x = Random(1, UBound($aArray) - 1, 1) While $sda.Exists($x) $x = Random(1, UBound($aArray), 1) WEnd $sda.Item($aArray[$x]) Until Not Mod(($sda.Count - 1), $icount) $aResult = $sda.Keys() $aResult[0] = UBound($aResult) - 1 _ArraySort($aResult, 0, 1) _ArrayDisplay($aResult, "Unique") EndFunc ;==>_add Func Terminate() Exit EndFunc Edited August 5, 2022 by Deye Link to comment Share on other sites More sharing options...
Solution Deye Posted August 5, 2022 Author Solution Share Posted August 5, 2022 It needs to be While $sda.Exists($aArray[$x]) Link to comment Share on other sites More sharing options...
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