Minimize Problem
A bunch of values has to be spread into an array randomly. None may be double. Random values are allowed and do not have to be in ascending or descending order.

Minimize Solution
It works a bit like playing roulette with many bowls. The values, pushed on the parameter buffer, will be put into the array by looping through the index of the array. A random index chooses the next lot. If it is occupied (<>0) the index jumps 1 lot further, until it finds one free.

See also a thread on www.archiforum.info.

Minimize Script

DIM array[4] : n=4 !»» destination array
PUT 4,12,7,16
!»» values to spread

FOR i=1 TO n !»» loop to get all values
  s=2+INT(RND(n)) : j=0
  WHILE s>0 DO !»» loop to find a free position
    j=j+1 : IF j>n THEN j=1
!»» loop through the array positions
    IF array[j]=0 THEN s=s-1 !»» jump over occupied positions
    ENDWHILE
 
array[j]=GET(1)
  NEXT i