Dubler Posted July 19, 2010 Share Posted July 19, 2010 (edited) Hi! I have problem with my program: i have $1, $2, $3, $4, $5 and $6 I want in order to they were not repeated. I using that: $1 = Random(1, 49, 1) $2 = Random(1, 49, 1) $3 = Random(1, 49, 1) $4 = Random(1, 49, 1) $5 = Random(1, 49, 1) $6 = Random(1, 49, 1) And second question: how to do automatic mail sender for yahoo? Edited July 19, 2010 by Dubler Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted July 19, 2010 Moderators Share Posted July 19, 2010 Dubler, Welcome to the AutoIt forum. Here is one way to get 6 unique random numbers between 1-49 inclusive - which is what I believe you asked. #include <Array.au3> Global $aArray[6], $1, $2, $3, $4, $5, $6 ; For each element of the array For $i = 0 To 5 ; Start a loop While 1 ; Get a random number in the range $iTemp = Random(1, 49, 1) ; Clear error flag $fError = 0 ; Check if the value is already in the array For $j = 0 To $i - 1 ; if it is, set the flag If $aArray[$j] = $iTemp Then $fError = 1 Next ; If the flag is not set If $fError = 0 Then ; Store the value in the array for later checking $aArray[$i] = $iTemp ; Assign the value to the variable Assign($i + 1, $iTemp) ; Leave the loop and move on to the next element ExitLoop EndIf ; If the flag was set, get another random value and search again WEnd Next ; Display the results MsgBox(0, "Result", "$1 = " & $1 & @CRLF & "$2 = " & $2 & @CRLF & "$3 = " & $3 & @CRLF & "$4 = " & $4 & @CRLF & "$5 = " & $5 & @CRLF & "$6 = " & $6) To learn about sending mail - use the Search box at top right. You will find many topics about it like this one. 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