-
-
Save nysander/03609236c22c935bb25a91a9a6afd20e to your computer and use it in GitHub Desktop.
This file contains 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
var users = [Int: UUID]() | |
var talks = [UUID]() | |
var csv = "" | |
for index in 0..<100 { | |
users[index] = UUID() | |
} | |
for _ in 0..<500 { | |
talks.append(UUID()) | |
} | |
var x = [UUID: UUID]() | |
var counter = 0 | |
func loop() { | |
for (idx, talk) in talks.enumerated() { | |
for _ in 0..<Int.random(in: 1..<50) { | |
let index = Int.random(in: 0..<100) | |
let rating = Int.random(in: 1...9) | |
if let talkCache = users[index], talkCache == talk { | |
continue | |
} | |
x[users[index]!] = talk | |
csv = csv + "\(counter),\"\(users[index]!)\",\(rating),\"\(talk)\",\(idx)\n" | |
counter += 1 | |
} | |
} | |
} | |
loop() | |
print(csv) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment