Files
go-easy-utils/mathx/rand_example_test.go
2025-07-08 15:26:54 +08:00

24 lines
318 B
Go

package mathx
import "fmt"
func ExampleRand() {
minInt := 1
maxInt := 100
res1 := Rand(minInt, maxInt)
if res1 >= 1 && res1 <= 100 {
fmt.Println("ok")
}
minFloat := 1.0
maxFloat := 10.0
res2 := Rand(minFloat, maxFloat)
if res2 >= 1.0 && res2 <= 10.0 {
fmt.Println("ok")
}
// Output:
// ok
// ok
}