How can I make numbers appear unsorted in a list box after doing a while loop? I have a dialog that has a list box, and when I click on the "Loop" button, it will generate a number list from 1 - 9999, then it displays the numbers in the list box. That works fine, but I want the numbers to appear in random order in the listbox instead of in numeric order.


Here's my code:

Code:

dialog loop {
  title "Loop test"
  size -1 -1 79 104
  option dbu
  list 1, 3 3 72 83, size
  button "Loop", 2, 21 89 37 12
  button "", 3, 0 0 0 0, hide cancel
}

on *:dialog:loop:sclick:2:{
  did -r $dname 1
  did -b $dname 2
  var %i = 1
  while (%i <= 9999) {
    did -a $dname 1 $ifmatch
    inc %i
  }
 did -e $dname 2 
}