     
     func randomCGFloat() -> CGFloat {
         return CGFloat(Float(arc4random()) / Float(UINT32_MAX))
+    }
+    
+    func lengthOf(s: CGPoint, e: CGPoint) -> CGFloat {
+        let xDiff = e.x - s.x
+        let yDiff = e.y - s.y
+        return sqrt(xDiff * xDiff + yDiff * yDiff)
     }
     
     /**

        self.runAction(SKAction.repeatActionForever(
            SKAction.sequence([
                SKAction.runBlock({
                    self.generateRandomLinesAndBalls();
                    self.drawLinesAndBallsOffCanvas(self.lines, balls: self.balls, duration: self.gameSpeed);
                }),
                SKAction.waitForDuration(gameSpeed / (3 / 0.8))

    let resWidthRatio = CGFloat(0.8);
    let resHeightRatio = CGFloat(0.8);
    var gameSpeed = 20.0
    var lineCap = 4
    
    var balls = [(SKNode, SKNode)]()
    var lines : [SKNode] = [];
