Skip to content

Instantly share code, notes, and snippets.

@webuilder240
Created March 13, 2022 01:58
Show Gist options
  • Save webuilder240/e91cc7d20f08fbeaef53679e93deaa27 to your computer and use it in GitHub Desktop.
Save webuilder240/e91cc7d20f08fbeaef53679e93deaa27 to your computer and use it in GitHub Desktop.
// https://twitter.com/justin999_/status/1293738518989029379?s=21
//
// 1万個のarrayを高速で作る方法を考えよ。
// Swiftでいうなら、[[Int]]。
// なお、それぞれのarrayの中身はランダム、長さは7である
// [
// [1, 3, 9, 0, 1, 2, 4],
// [1, 9, 0, 7, 9 ,1, 2],
// ....(1万個)
// ]
result = []
for (let i = 0; i < 10000; i++) {
let tmp = []
for(j = 0; j < 7; j++) {
tmp.push(Math.floor(Math.random() * 9))
}
result.push(tmp)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment