Perl Function: random_mac()

Function to generate a random MAC address. Just for testing.

sub random_mac() { my ($mac,$i); for ($i=0;$i<6;$i++) { $mac .= zeropad(sprintf("%x",rand() * 255)) . ":"; } $mac = substr($mac,0,length($mac)-1); return $mac; }
Leave A Reply
All content licensed under the Creative Commons License