## Recommended Posts

Hi,

I have the folowing script :

#include <Array.au3>

Dim \$R

Dim \$Num1

Randomize()

_ArrayDisplay( \$R, " Array")

MsgBox (0, "Test", \$Num1)

Func Randomize()

\$R = Random(1, 45, 1)

\$R = Random(1, 45, 1)

\$R = Random(1, 45, 1)

\$R = Random(1, 45, 1)

\$R = Random(1, 45, 1)

\$R = Random(1, 45, 1)

If \$R = \$R Or \$R = \$R Or \$R = \$R Or \$R = \$R Or \$R = \$R Then Randomize ()

If \$R = \$R Or \$R = \$R Or \$R = \$R Or \$R = \$R Then Randomize ()

If \$R = \$R Or \$R = \$R Or \$R = \$R Then Randomize ()

If \$R = \$R Or \$R = \$R Then Randomize ()

_ArraySort(\$R, 0, 1)

\$Getal1 = _ArrayToString (\$R, 1, )

EndFunc

This script generates a Array with 7 numbers between 1 and 45. How can I get a value out of an Array and put it in a string. I want to do this because the array is sorted. For example I want to create variables like this

\$Num1 = _ArrayToString (\$R, 1, 1, )

\$Num2 = _ArrayToString (\$R, 2, 2, )

\$Num3 = _ArrayToString (\$R, 3, 3, )

\$Num4 = _ArrayToString (\$R, 4, 4, )

\$Num5 = _ArrayToString (\$R, 5, 5, )

\$Num6 = _ArrayToString (\$R, 6, 6, )

\$Num7 = _ArrayToString (\$R, 7, 7, )

Is this posible ?

##### Share on other sites

Errm...

like this?:

`\$string = \$r &","&\$r&","&\$r&","&\$r&","&\$r&","&\$r&","&\$r`

#)

Thanks this is what I was searching for. Thanks a lot.

##### Share on other sites

Your post intrigued me, and I ended up writing a full UDF that loads a one dimension array with random numbers with lots of options.

## Create an account

Register a new account

• ### Recently Browsing   0 members

×

• Wiki

• Back

• #### Beta

• Git
• FAQ
• Our Picks
×
• Create New...