Jump to content
Sign in to follow this  

Need some help with random numbers

Recommended Posts


Hi there,

I could use some help on a little prog of mine.

I just want the programm to spit out a random number but: the user using this prog wants to give a couple of numbers from which this one is chosen. i though about something like this:

dim $c[4]
$a = inputbox ("numbers", "seperate by ','")
$b = stringsplit ($a, ",")
for $e = 1 to 3 step 1
$c[$e] = random (1, 100,1)
$d = 0
$d = $d + 1
until $d = $b[0] or $c[$e] = $b[$d]
until $c[$e] = $b[$d]
msgbox (0, "", $c[1] & "." & $c[2] & "." & $c[3])

I'm so far at the moment but how can I manage that I have no double numbers?

I'm getting really sick because of this.

Share this post

Link to post
Share on other sites

#include <Array.au3>
Dim $avArray[1]

For $i = 1 to 19;for testing
_ArrayAdd( $avArray, $i)
$avArray[$i] = $i

$min = _ArrayMin ( $avArray, 1 ) + 1
$max = _ArrayMax ( $avArray, 1 )

$rnd = Random ( $min , $max , 1 )
;MsgBox(64, "Testing", $rnd)

_ArrayDelete ( $avArray, $rnd )
_ArraySort ( $avArray)
_ArrayDisplay( $avArray, "New Array" )

Share this post

Link to post
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
Sign in to follow this  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.