metis Posted April 25, 2011 Share Posted April 25, 2011 ;start Msgbox(0,"","1") ;1 Msgbox(0,"","2") ;2 Msgbox(0,"","3") ;3 ;End I need variable(los order) Msgbox.( Results 2,1,3 ; 3,2,1 ; 1,3,2 etc..... ) Link to comment Share on other sites More sharing options...
UEZ Posted April 25, 2011 Share Posted April 25, 2011 Hmmm, same question but new thread -> What are you expecting now? Br, UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
wakillon Posted April 25, 2011 Share Posted April 25, 2011 Hmmm, same question but new thread -> What are you expecting now?Br,UEZI knew I'd already seen this question ! AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted April 25, 2011 Moderators Share Posted April 25, 2011 metis, #include <Array.au3> HotKeySet("{ESC}", "On_Exit") Global $aBase[3] = [1, 2, 3] $aPermute = _ArrayPermute($aBase) _ArrayDisplay($aPermute) While 1 $iIndex = Random(1, $aPermute[0], 1) MsgBox(0, "Info", "Starting a new random set") $aDisplay = StringSplit($aPermute[$iIndex], "") For $i = 1 To $aDisplay[0] MsgBox(0, "", $aDisplay[$i]) Next WEnd Func On_Exit() Exit EndFunc M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
metis Posted April 25, 2011 Author Share Posted April 25, 2011 Code not work ;/ #include <Array.au3> HotKeySet("{ESC}", "On_Exit") Global $aBase[50] = ["1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31","32","33","34","35","36","37","38","39","40","41","42","43","44","45","46","47","48","49","50"] $aPermute = _ArrayPermute($aBase) ;~ _ArrayDisplay($aPermute) While 1 $iIndex = Random(1, $aPermute[0], 1) MsgBox(0, "Info", "Starting a new random set") $aDisplay = StringSplit($aPermute[$iIndex], "") _ArrayDisplay($aDisplay) _ArrayDisplay($iIndex) For $i = 1 To $aDisplay[0] MsgBox(0, "", $aDisplay[$i]) Next WEnd Func On_Exit() Exit EndFunc Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted April 26, 2011 Moderators Share Posted April 26, 2011 metis,Please try and be a little more sociable rather than communicating in staccato phrases - it makes everyone more willing to help. Now "Code not work" is not very informative. Next time please give some indication of what error messages you got - it is very helpful when you start debugging.The reason the code does not work is because the number of permutations of the 50-element array that _ArrayPermute produces results in an array too large for AutoIt to handle. Your initial request only dealt with a 3-element array so the number of permutations was much smaller - of interest it is based on a factorial and there is a big difference between 3! and 50!, as I am sure you know. So we need to go another route - this code redeclares the array on each pass and then (using a pretty standard algorithm) randomly rearranges the elements:#include <Array.au3> HotKeySet("{ESC}", "On_Exit") While 1 Global $aArray[50] = ["1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25", _ "26","27","28","29","30","31","32","33","34","35","36","37","38","39","40","41","42","43","44","45","46","47","48","49","50"] _ArrayDisplay($aArray) For $i = UBound($aArray) - 1 To 1 Step -1 $j = Random(0, $i, 1) $Temp = $aArray[$j] $aArray[$j] = $aArray[$i] $aArray[$i] = $Temp Next _ArrayDisplay($aArray) MsgBox(0, "Info", "Starting a new random set") For $i = 1 To UBound($aArray) - 1 MsgBox(0, "", $aArray[$i]) Next WEnd Func On_Exit() Exit EndFuncIs that what you wanted? M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area 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