Created
May 28, 2014 15:18
-
-
Save benlemasurier/0747a0382091bb07fc7f to your computer and use it in GitHub Desktop.
Generate a random MAC address
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func randomMAC() string { | |
macBuf := make([]byte, 3) | |
if _, err := rand.Read(macBuf); err != nil { | |
panic(err) | |
} | |
return fmt.Sprintf("aa:bb:cc:%02x:%02x:%02x", macBuf[0], macBuf[1], macBuf[2]) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment