Created
June 13, 2015 17:20
-
-
Save rubenroques/eb1c780209e0f0b3abb2 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
//: Playground - noun: a place where people can play | |
import UIKit | |
func generateRandom()-> Int | |
{ | |
let randomNumber :Int = Int(arc4random_uniform(20)) | |
switch randomNumber | |
{ | |
case 1,2,3,4,8,11,13,14,18: | |
return 0 | |
case 5,6,7: | |
return 1 | |
case 9,10,20: | |
return 2 | |
case 12,19: | |
return 3 | |
case 15: | |
return 4 | |
default: | |
return 1 | |
} | |
} | |
func createWeek() -> [Int] { | |
var week : [Int] = [] | |
for day in 0..<85 { | |
week.append(generateRandom()) | |
} | |
return week | |
} | |
func generateCommits(limit max:Int = 7){ | |
var months : [[Int]] = [] | |
for week in 0...max { | |
months.append(createWeek()) | |
} | |
print(months) | |
} | |
generateCommits() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment