-Reseed random generator to reduce chances of collision (though uniqueness still should be guaranteed elsewhere)

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@4284 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
jbjohnso 2009-10-02 14:48:26 +00:00
parent 10fe928cf4
commit 31288324bd

View File

@ -85,6 +85,7 @@ sub getMacAddresses {
sub genMac { #Generates a mac address for a node, does NOT assure uniqueness, calling code needs to do that
my $node=shift;
my $prefix = shift;
srand(); #Re-seed the rng. I haven't been able to reproduce it, but duplicate macs were somehow making it
if ($prefix) { #Specific prefix requested, honor it
my $tail = int(rand(0xffffff)); #With only 24 bits of space, use random bits;
$tail = sprintf("%06x",$tail);