Created
May 2, 2014 08:54
-
-
Save sauloperez/771cfba97cf6e2397e95 to your computer and use it in GitHub Desktop.
IEEE locally-assigned MAC addresses
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
# 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