Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
IEEE locally-assigned MAC addresses
# Generates IEEE locally-assigned MAC addresses
# @return [String] following the pattern [0-9A-Fa-f][26AEae][0-9A-Fa-f]{10}
def mac
mac = ('%0.2X' % rand(256))[0, 1] + %w(2 6 A E).sample
mac << (1..5).map { "%0.2X" % rand(256) }.join
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment