mirror of
https://github.com/jefferyjob/go-easy-utils.git
synced 2025-10-04 22:52:40 +08:00
14
mathUtil/rand_test.go
Normal file
14
mathUtil/rand_test.go
Normal file
@@ -0,0 +1,14 @@
|
||||
package mathUtil
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestRand(t *testing.T) {
|
||||
min := 1
|
||||
max := 100
|
||||
for i := 0; i < 1000; i++ {
|
||||
num := Rand(min, max)
|
||||
if num < min || num > max {
|
||||
t.Errorf("randRange() returned %d, which is outside the range of [%d, %d]", num, min, max)
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user