Created
August 26, 2016 09:54
-
-
Save vjosullivan/7b6f0debbd181f38903fba814632b778 to your computer and use it in GitHub Desktop.
Swift 3. Creates an array of n integers with random values in the range 0..<max. As written below, the code will generates 10 integers in the range 0..<100.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let testData = { (n: Int, max: UInt32) -> [Int] in | |
var array = [Int]() | |
for i in 0..<n { | |
array.append(Int(arc4random_uniform(max))) | |
} | |
return array | |
}(10, 100) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment