Created
October 11, 2017 20:06
-
-
Save yurimorales/bfece5bcb112b911a6b036c9275ff63a to your computer and use it in GitHub Desktop.
Random Number Go
This file contains 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
package main | |
import ( | |
"fmt" | |
"math/rand" | |
"time" | |
) | |
func randomNumber(min int, max int) int { | |
rand.Seed(time.Now().UnixNano()) | |
foo := rand.Intn(max) + min | |
return foo | |
} | |
func main() { | |
retorno := randomNumber(1, 100) | |
fmt.Println("O numero randomico sorteado: ", retorno) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment