diff --git a/golangr/file-reader/main.go b/golangr/file-reader/main.go index cfe7286..75215fe 100644 --- a/golangr/file-reader/main.go +++ b/golangr/file-reader/main.go @@ -3,6 +3,7 @@ package main import ( "bufio" "fmt" + "math/rand" "os" ) @@ -29,5 +30,9 @@ func main() { } fmt.Println(names) + //fmt.Println(len(names)) + + randName := rand.Intn(len(names) - 0) + fmt.Printf("The chosen name is %v\n", names[randName]) }