Merge remote-tracking branch 'ooo/master'
This commit is contained in:
@@ -75,6 +75,7 @@ public class MACUtil
|
||||
// 02-03-8A-00-00-11 - Westell Dual (USB/Ethernet) modem
|
||||
// FF-FF-FF-FF-FF-FF - Tunnel adapter Teredo
|
||||
// 02-00-4C-4F-4F-50 - MSFT thinger, loopback of some sort
|
||||
// 00-00-00-00-00-00(-00-E0) - IP6 tunnel
|
||||
if (mac.startsWith("44-45-53")) {
|
||||
continue;
|
||||
} else if (mac.startsWith("00-53-45-00")) {
|
||||
@@ -91,6 +92,8 @@ public class MACUtil
|
||||
continue;
|
||||
} else if (mac.startsWith("02-00-4C-4F-4F-50")) {
|
||||
continue;
|
||||
} else if (mac.startsWith("00-00-00-00-00-00")) {
|
||||
continue;
|
||||
}
|
||||
|
||||
list.add(mac);
|
||||
|
||||
@@ -93,6 +93,26 @@ public class Randoms
|
||||
return low + (_r.nextFloat() * (high - low));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a pseudorandom, uniformly distributed <code>double</code> value between
|
||||
* <code>0.0</code> (inclusive) and the <code>high</code> (exclusive).
|
||||
*
|
||||
* @param high the high value limiting the random number sought.
|
||||
*/
|
||||
public double getDouble (double high)
|
||||
{
|
||||
return _r.nextDouble() * high;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a pseudorandom, uniformly distributed <code>double</code> value between
|
||||
* <code>low</code> (inclusive) and <code>high</code> (exclusive).
|
||||
*/
|
||||
public double getInRange (double low, double high)
|
||||
{
|
||||
return low + (_r.nextDouble() * (high - low));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true approximately one in <code>n</code> times.
|
||||
*
|
||||
@@ -106,9 +126,9 @@ public class Randoms
|
||||
/**
|
||||
* Has a probability <code>p</code> of returning true.
|
||||
*/
|
||||
public boolean getProbability (float p)
|
||||
public boolean getProbability (double p)
|
||||
{
|
||||
return _r.nextFloat() < p;
|
||||
return _r.nextDouble() < p;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -176,18 +196,6 @@ public class Randoms
|
||||
return pickPluck(iterable, ifEmpty, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Pick a random element from the specified array, or return <code>ifEmpty</code>
|
||||
* if it is empty.
|
||||
*
|
||||
* @throws NullPointerException if the array is null.
|
||||
*/
|
||||
public <T> T pick (T[] array, T ifEmpty)
|
||||
{
|
||||
int size = array.length;
|
||||
return (size == 0) ? ifEmpty : array[_r.nextInt(size)];
|
||||
}
|
||||
|
||||
/**
|
||||
* Pick a random <em>key</em> from the specified mapping of weight values, or return
|
||||
* <code>ifEmpty</code> if no mapping has a weight greater than <code>0</code>. Each
|
||||
|
||||
Reference in New Issue
Block a user