Sign in to follow this  
Followers 0
Nuffilein805

Need some help with random numbers

2 posts in this topic

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
Do
$c[$e] = random (1, 100,1)
$d = 0
Do 
$d = $d + 1
until $d = $b[0] or $c[$e] = $b[$d]
until $c[$e] = $b[$d]
Next
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
next

$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  
Followers 0