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; }


Note: Replies will be formatted with PHP Markdown Extra syntax.

Name: Email (Not Required):
 
Logged IP: 3.234.143.26
To prevent spam please submit by clicking the kitten: