let randomIntFrom0To10 = Int.random(in: 0 ..< 10)
let randomFloat = Float.random(in: 0 ..< 1)
let greetings = ["hey", "hi", "hello", "hola"]
print(greetings.randomElement()!)
let randomlyOrderedGreetings = greetings.shuffled()
struct Restaurant: Equatable {
let name: String
let hasTableService: Bool
let kidFriendly: Bool
}
enum Either<Left, Right> {
case left(Left)
case right(Right)
}
extension Either: Equatable where Left: Equatable, Right: Equatable { }
struct City {
let name: String
let state: String
let population: Int
}
extension City: Hashable {
func hash(into hasher: inout Hasher) {
name.hash(into: &hasher)
}
state.hash(into: &hasher)
}
enum Gait: CaseIterable {
case walk
case trot
case canter
case gallop
case jog
}
for gait in Gait.allCases {
print(gait)
}