For example I have a array which is{1,2,3,4}

What is the most efficient method to make the sequence random? To be {4,1,2,3} or {3,2,1,4}…something like that.

Use a Shuffle algorithm. Fisher–Yates shuffle - Wikipedia

I’m sorry for down voting the “use sorting” answers, but they are actually dangerously wrong.

Thanks ChrisD.

I refered to the link. Below is the way of doing, although don’t know how this .sort(Com_Func.randomSort) thing works.

```
var xxx=new Array(0,1,2,3);
xxx.sort(Com_Func.randomSort);
static function randomSort(a,b) {
// Get a random number between 0 and 10
var temp = parseInt( Random.value*10 );
// Get 1 or 0, whether temp is odd or even
var isOddOrEven = temp%2;
// Get +1 or -1, whether temp greater or smaller than 5
var isPosOrNeg = temp>5 ? 1 : -1;
// Return -1, 0, or +1
return( isOddOrEven*isPosOrNeg );
}
```