Added reading a random line from a file
This commit is contained in:
parent
1bf9e3e27c
commit
0fe0cc29a0
|
@ -3,6 +3,7 @@ package main
|
||||||
import (
|
import (
|
||||||
"bufio"
|
"bufio"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"math/rand"
|
||||||
"os"
|
"os"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -29,5 +30,9 @@ func main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Println(names)
|
fmt.Println(names)
|
||||||
|
//fmt.Println(len(names))
|
||||||
|
|
||||||
|
randName := rand.Intn(len(names) - 0)
|
||||||
|
fmt.Printf("The chosen name is %v\n", names[randName])
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue