private var randInit = false private func rand() -> Double { if !randInit { srand48(time(nil)) randInit = true } return drand48() }