Jump to content

Using Random and small question about mail


Recommended Posts

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 by Dubler
Link to comment
Share on other sites

  • Moderators

Dubler,

Welcome to the AutoIt forum. :blink:

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. :P

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...