package main
import (
"fmt"
"math/rand"
"time"
)
func genRandNums(min, max float64) []float64 {
var randNums []float64
s := rand.NewSource(time.Now().Unix())
r := rand.New(s)
for x := 0; x < 10; x++ {
// generate random float in range of min and max inclusive, append
// to randNums and return randNums
}
return randNums
}
func main() {
nums := genRandNums(1.10, 101.98)
fmt.Println(nums)
}
I have tried searching online on how to accomplish this, but I only found out how to generate random integers in a range. Is there any way I can generate random floats in a range using Go stdlib?