Skip to content

Instantly share code, notes, and snippets.

View igorangelov's full-sized avatar
🏠
Working from home

igorangelov

🏠
Working from home
  • Paris
View GitHub Profile
@ijoshsmith
ijoshsmith / Array+Shuffle.swift
Last active December 24, 2018 21:55
Randomly shuffle a Swift array
import Foundation
extension Array
{
/** Randomizes the order of an array's elements. */
mutating func shuffle()
{
for _ in 0..<10
{
sort { (_,_) in arc4random() < arc4random() }