Replaced custom function for generation of random uint64s with rand.Uint64.

This commit is contained in:
Dmitri Dolguikh 2018-01-04 13:02:59 -08:00 committed by Dave Anderson
parent 3268bf94a3
commit 1ae9c3ab68

View File

@ -94,7 +94,7 @@ func (p *RandomAddressPool) ReserveAddresses(clientID []byte, interfaceIDs [][]b
for {
// we assume that ip addresses adhere to high 64 bits for net and subnet ids, low 64 bits are for host id rule
hostOffset := randomUint64(rng) % p.poolSize
hostOffset := rand.Uint64() % p.poolSize
newIP := big.NewInt(0).Add(p.poolStartAddress, big.NewInt(0).SetUint64(hostOffset))
_, exists := p.usedIps[newIP.Uint64()];
if !exists {
@ -153,7 +153,3 @@ func (p *RandomAddressPool) calculateIAIDHash(clientID, interfaceID []byte) uint
h.Write(interfaceID)
return h.Sum64()
}
func randomUint64(rng *rand.Rand) uint64 {
return uint64(rng.Uint32())<<32 + uint64(rand.Uint32())
}