self.isEmpty == false else { return nil } let randomIndex = arc4random_uniform(UInt32(self.count)) return self[Int(randomIndex)] } mutating func keepLast(_ n: Int = 1) { guard self.count > n else { return } let removingElementsCount = self.count - n self.removeFirst(removingElementsCount) } }