Created
July 25, 2018 16:05
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // 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