Instance Method

shuffled()

Returns a new array that lists this array’s elements in a random order.

Declaration

func shuffled() -> [Any]

Return Value

A new array that lists this array’s elements in a random order.

Discussion

Calling this method is equivalent to calling the shuffled(using:) method and passing the system sharedRandom() random source. To influence the random shuffling or to be able to deterministically reproduce a series of shuffles, create your own GKRandomSource object.

See Also

Randomly Shuffling an Array

func shuffled(using: GKRandomSource)

Returns a new array that lists this array’s elements in a random order, using the specified random source.