drivers/virtualbox/virtualbox.go
func getRandomIPinSubnet(d *Driver, baseIP net.IP) (net.IP, error) {
	var dhcpAddr net.IP

	nAddr := baseIP.To4()
	// select pseudo-random DHCP addr; make sure not to clash with the host
	// only try 5 times and bail if no random received
	for i := 0; i < 5; i++ {
		n := d.randomInter.RandomInt(24) + 1
		if byte(n) != nAddr[3] {
			dhcpAddr = net.IPv4(nAddr[0], nAddr[1], nAddr[2], byte(n))
			break
		}
	}

	if dhcpAddr == nil {
		return nil, ErrUnableToGenerateRandomIP
	}

	return dhcpAddr, nil
}
func getRandomIPinSubnet(d *Driver, baseIP net.IP) (net.IP, error) {
	var dhcpAddr net.IP

	nAddr := baseIP.To4()
	// select pseudo-random DHCP addr; make sure not to clash with the host
	// only try 5 times and bail if no random received
	for i := 0; i < 5; i++ {
		n := d.randomInter.RandomInt(24) + 1
		if byte(n) != nAddr[3] {
			dhcpAddr = net.IPv4(nAddr[0], nAddr[1], nAddr[2], byte(n))
			break
		}
	}

	if dhcpAddr == nil {
		return nil, ErrUnableToGenerateRandomIP
	}

	return dhcpAddr, nil
}
func getRandomIPinSubnet ( d * Driver , baseIP net . IP ) ( net . IP , error ) { var dhcpAddr net . IP nAddr := baseIP . To4 ( ) // select pseudo-random DHCP addr; make sure not to clash with the host // only try 5 times and bail if no random received for i := 0 ; i < 5 ; i ++ { n := d . randomInter . RandomInt ( 24 ) + 1 if byte ( n ) != nAddr [ 3 ] { dhcpAddr = net . IPv4 ( nAddr [ 0 ] , nAddr [ 1 ] , nAddr [ 2 ] , byte ( n ) ) break } } if dhcpAddr == nil { return nil , ErrUnableToGenerateRandomIP } return dhcpAddr , nil }
// getRandomIPinSubnet returns a pseudo-random net.IP in the same
// subnet as the IP passed
getRandomIPinSubnet returns a pseudo - random net . IP in the same subnet as the IP passed