network port

master
Charles Iliya Krempeaux 2022-12-14 06:36:14 -08:00
parent 61ef62e23d
commit f58be2f83d
2 changed files with 32 additions and 0 deletions

View File

@ -26,6 +26,11 @@ func NetAddr() net.Addr {
return Default.NetAddr()
}
// NetPort returns an arbitrary network port.
func NetPort() uint16 {
return Default.NetPort()
}
// Password returns an arbitrary password.
func Password() string {
return Default.Password()

27
t_netport.go 100644
View File

@ -0,0 +1,27 @@
package arbitrary
// NetPort returns an arbitrary network port.
func (arb T) NetPort() uint16 {
var port uint16
{
port = uint16(arb.randomness.Intn(65536))
if 0 == arb.randomness.Intn(5) {
port = uint16(arb.randomness.Intn(1024))
}
if 0 == arb.randomness.Intn(4) {
port = uint16(arb.randomness.Intn(100))
}
if 0 == arb.randomness.Intn(30) {
port = 80
}
if 0 == arb.randomness.Intn(29) {
port = 79
}
}
return port
}