Hello!
Your idea is realized with the help of a repeater. Below is an example text for 9 elements. In your case, you need to determine how many you will be on the screen and assign the same number of containers to the repeater accordingly. Random indices are indices calculated in advance using a random number generator.
$w . onReady ( function () {
$w ( ‘#text3’ ). text = “<- When the button is pressed, the elements of the repeater are swapped”
const tempData = $w ( “#repeater1” ). data ;
let ari = [ 1 , 5 , 3 , 2 , 0 , 8 , 4 , 6 , 7 ] // random indexes
$w ( “#iconButton1” ). onClick (( event ) => {
for ( let index = 0 ; index < tempData . length ; index ++) {
tempData [ ari [ index ]] = $w ( “#repeater1” ). data [ index ];
}
$w ( “#repeater1” ). data = tempData ;
});
})