Skip to content

Instantly share code, notes, and snippets.

void giveGifts(int iteration) {
NSArray *people = @[@"a", @"b", @"c", @"d", @"e"];
NSMutableArray *given = [NSMutableArray array];
NSMutableArray *received = [NSMutableArray array];
int count = 0; //we don't accidentally want an infinate loop
while (people.count != given.count && people.count != received.count && count < 2000) {
int a = arc4random_uniform((int32_t)people.count);
int b = arc4random_uniform((int32_t)people.count);
extension CGPoint {
mutating func move(x:Int? = nil, y:Int? = nil) -> CGPoint {
if let i = x {
self.x += CGFloat(i)
}
if let i = y {
self.y += CGFloat(i)
}