Skip to content

Instantly share code, notes, and snippets.

@benlemasurier
Created May 28, 2014 15:18
Show Gist options
  • Save benlemasurier/0747a0382091bb07fc7f to your computer and use it in GitHub Desktop.
Save benlemasurier/0747a0382091bb07fc7f to your computer and use it in GitHub Desktop.
Generate a random MAC address
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