Skip to content

Instantly share code, notes, and snippets.

@yunustek
Created October 7, 2018 16:56
Show Gist options
  • Save yunustek/ec055f9a0cdb5557eb420e95343ebf9b to your computer and use it in GitHub Desktop.
Save yunustek/ec055f9a0cdb5557eb420e95343ebf9b to your computer and use it in GitHub Desktop.
shuffle()
var names = ["Alejandro", "Camila", "Diego", "Luciana", "Luis", "Sofía"]
names.shuffle()
//names == ["Luis", "Camila", "Luciana", "Sofía", "Alejandro", "Diego"]
let numbers = 0…9
let shuffledNumbers = numbers.shuffled()
// shuffledNumbers == [1, 7, 6, 2, 8, 9, 4, 3, 5, 0]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment