Jump to content

Recommended Posts

Posted (edited)

Use a loop : For 1 To 5. You will need to use functions Random() and FileWriteLine() inside the loop. FileOpen() must be placed before the loop and FileClose() must be placed after the loop. Run the Help File examples for these functions and then try to write some code. Post your efforts here so we can offer advice on coding, or if you get stuck.

Edited by czardas
Posted (edited)

You must make an attempt to write the code yourself. Here's an example to get you started. Run the code and see what it does. Then modify it to get it to do what you want it to do.

Global $iRandom ; Declare a variable - to store the random numbers

; COMMENT - FileOpen goes here

For $i = 1 To 5
    ; generate a random integer between 7 and 23
    $iRandom = Random(7, 23, 1)
    MsgBox(0, "Message", "Random Number = " & $iRandom)
    
    ; COMMENT - Write $iRandom to file using FileWriteLine()
Next

; COMMENT - FileClose() goes here

 

Edited by czardas

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
  • Recently Browsing   0 members

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