This function takes an array and shuffles the order of the values and returns the randomly ordered array with all of the values re-indexed from 1 onward.
Example:
@foo->1 = "Foo 1" @foo->2 = "Foo 2" @foo->3 = "Foo 3" @foo->4 = "Foo 4" @foo->5 = "Foo 5"
@shuffled = %arrayShuffle( @foo )
foreach( @shuffled as @key => @value ) { echo Key: @key, Value: @value } endforeach
Output:
Key: 1, Value: Foo 4 Key: 2, Value: Foo 2 Key: 3, Value: Foo 3 Key: 4, Value: Foo 5 Key: 5, Value: Foo 1 |