Skip to content

Instantly share code, notes, and snippets.

@andru255
Created July 25, 2018 16:05
Show Gist options
  • Select an option

  • Save andru255/1cc01795eb6d3ad47bbe63e093d7d638 to your computer and use it in GitHub Desktop.

Select an option

Save andru255/1cc01795eb6d3ad47bbe63e093d7d638 to your computer and use it in GitHub Desktop.
Función que retorna un número aleatorio en base a un rango de números, en este caso recibe 2 parámetros, el número mínimo y el máximo
// Función original
func randomNumber(min: Int, max: Int) -> Int {
// implementación original
return min + Int(arc4random_uniform(UInt32(max - min + 1)))
}
let myNumber = randomNumber(min: 5, max: 31) //retorna un número aleatorio
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment