I am using GKRandomSource
in a struct to return a random inspirational quote in the view. Is there a way to return that random number and omit the prior entry? That way the user doesn't receive the same quote twice in a row.
let inspiration = [
"You are looking rather nice today, as always.",
"Hello gorgeous!",
"You rock, don't ever change!",
"Your hair is looking on fleek today!",
"That smile.",
"Somebody woke up on the right side of bed!"]
func getRandomInspiration() -> String {
let randomNumber = GKRandomSource.sharedRandom().nextIntWithUpperBound(inspiration.count)
return inspiration[randomNumber]
}