广告涉及的mq都放这里
25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2 달 전
12345678910111213141516171819202122232425262728293031
  1. package utils
  2. import (
  3. "math/rand"
  4. "time"
  5. )
  6. func RandFloats(min, max float64) float64 {
  7. rand.Seed(time.Now().UnixNano())
  8. return min + rand.Float64()*(max-min)
  9. }
  10. func RandInt(min, max int) int {
  11. if min >= max || min == 0 || max == 0 {
  12. if max == 0 {
  13. max = min
  14. }
  15. return max
  16. }
  17. return rand.Intn(max-min) + min
  18. }
  19. func RandIntRand(min, max int) int {
  20. if min >= max || min == 0 || max == 0 {
  21. if max == 0 {
  22. max = min
  23. }
  24. return max
  25. }
  26. return rand.Intn(max-min) + min
  27. }