mirror of
https://github.com/raz-varren/sacrificial-socket.git
synced 2025-10-07 00:52:48 +08:00
20 lines
375 B
Go
20 lines
375 B
Go
/*
|
|
Package tools is really just used during socket creation to generate random numbers for socket IDs.
|
|
*/
|
|
package tools
|
|
|
|
import (
|
|
"math/rand"
|
|
"time"
|
|
)
|
|
|
|
func RandomInt(min, max int) int {
|
|
rand.Seed(time.Now().UnixNano())
|
|
return rand.Intn(max-min+1) + min
|
|
}
|
|
|
|
func RandomInt64(min, max int64) int64 {
|
|
rand.Seed(time.Now().UnixNano())
|
|
return rand.Int63n(max-min+1) + min
|
|
}
|