From 1ae9c3ab683033d74d99909896e5b1ff0ff44924 Mon Sep 17 00:00:00 2001 From: Dmitri Dolguikh Date: Thu, 4 Jan 2018 13:02:59 -0800 Subject: [PATCH] Replaced custom function for generation of random uint64s with rand.Uint64. --- dhcp6/pool/random_address_pool.go | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/dhcp6/pool/random_address_pool.go b/dhcp6/pool/random_address_pool.go index 20cc717..5b98587 100644 --- a/dhcp6/pool/random_address_pool.go +++ b/dhcp6/pool/random_address_pool.go @@ -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()) -}