i need to create and random array from an array like this:
or create from zero an array from 1 to 16 but i need inside this "tarraysuoni" the values of 1 to 8 and repeated another time from 1 to 8....
This is my example that i need...:
Code: Select all
tlistasuoni [16]
put 1 into tlistasuoni[1]
put 2 into tlistasuoni[2]
put 3 into tlistasuoni[3]
put 4 into tlistasuoni[4]
put 5 into tlistasuoni[5]
put 6 into tlistasuoni[6]
put 7 into tlistasuoni[7]
put 8 into tlistasuoni[8]
put 1 into tlistasuoni[9]
put 2 into tlistasuoni[10]
put 3 into tlistasuoni[11]
put 4 into tlistasuoni[12]
put 5 into tlistasuoni[13]
put 6 into tlistasuoni[14]
put 7 into tlistasuoni[15]
put 8 into tlistasuoni[16]
i need to shuffle the elements of this array...and not the keys!!!..tlistasuoni
ok i have made a little code but this is wrong....can you help me??
Code: Select all
on mousedown
repeat until tlistasuoni[16] is not empty
If tlistasuoni[x] is empty then
If tlistasuoni[x] <> y then
put random(8) into y
put y into tlistasuoni[x]
add 1 to x
end if
end if
end repeat
end mousedown
The result is this: 2416374676313355 ...this is bad...
I need like this: 3254671834567128 thi is right...
Code: Select all
on mousedown
repeat until tlistasuoni[16] is not empty
If tlistasuoni[x] is empty then
If tlistasuoni[x] <> y then
put random(8) into y
put y into tlistasuoni[x]
add 1 to x
end if
end if
if tlistasuoni[x] = Y then ------------------little modify a little good but not right....
put y into tlistasuoni[x]
end if
end repeat
Result: 7518323486645281