Question: Whats the best/easiest way to get this:

what i have:

```
array('100', '100', '100', '80', '70', '70', '50', '45');

```

what the output should look like:

```
100 (random order)
100 (random order)
100 (random order)
80
70 (random order)
70 (random order)
50
45

```

Answer: 
you have to use usort or uasort (uasort keeps keys of the array). Using PHP 5.3, you may do it like this :

```
shuffle($array); // randomize

uasort($array, function($a, $b){
    if($a === $b) {
        return rand(0, 1);
    }
    return $a < $b;
});

```

You may have to name the function before, like the php documentation shows <http://www.php.net/manual/fr/function.uasort.php>
You can use usort (http://www.php.net/manual/en/function.usort.php) or uksort depending on your requirements. You can then choose to randomly return a positive or negative number if the values are equal.