Added reading a random line from a file

This commit is contained in:
raul 2024-02-07 17:15:34 +01:00
parent 1bf9e3e27c
commit 0fe0cc29a0
1 changed files with 5 additions and 0 deletions

View File

@ -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])
}