Skip to content

Instantly share code, notes, and snippets.

@el-hoshino
Last active August 29, 2015 14:16
Show Gist options
  • Save el-hoshino/e672e112d648073713bb to your computer and use it in GitHub Desktop.
Save el-hoshino/e672e112d648073713bb to your computer and use it in GitHub Desktop.
.map を利用して let でランダム数列を作る ref: http://qiita.com/lovee/items/f3515119883f05a8dac5
let randomIntArray = [Int](count: 10, repeatedValue: 0).map { (some: Int) -> Int in
let randomUInt = arc4random_uniform(100) // 0 ..< 100 の乱数を作る
return Int(randomUInt) - 50
}
[Int](0 ..< 10)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment