(Ab?)using Range.map to generate Arrays of random numbers:
let randoms = (1...n).map { _ in Int(arc4random()) }
Conversation
Replying to
Replying to
I’m pretty skeptical of any use of map() where the input values are ignored entirely. It’s really fake each() here.
3
Fair, though the nice thing about using map() is that it communicates how many outputs there will be to my scanning eye.
2
1
Show replies

