diff --git a/src/main/java/com/samskivert/net/MACUtil.java b/src/main/java/com/samskivert/net/MACUtil.java index f527277e..dbe3e641 100644 --- a/src/main/java/com/samskivert/net/MACUtil.java +++ b/src/main/java/com/samskivert/net/MACUtil.java @@ -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); diff --git a/src/main/java/com/samskivert/util/Randoms.java b/src/main/java/com/samskivert/util/Randoms.java index 74e5f323..630c25bb 100644 --- a/src/main/java/com/samskivert/util/Randoms.java +++ b/src/main/java/com/samskivert/util/Randoms.java @@ -93,6 +93,26 @@ public class Randoms return low + (_r.nextFloat() * (high - low)); } + /** + * Returns a pseudorandom, uniformly distributed double value between + * 0.0 (inclusive) and the high (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 double value between + * low (inclusive) and high (exclusive). + */ + public double getInRange (double low, double high) + { + return low + (_r.nextDouble() * (high - low)); + } + /** * Returns true approximately one in n times. * @@ -106,9 +126,9 @@ public class Randoms /** * Has a probability p 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 ifEmpty - * if it is empty. - * - * @throws NullPointerException if the array is null. - */ - public T pick (T[] array, T ifEmpty) - { - int size = array.length; - return (size == 0) ? ifEmpty : array[_r.nextInt(size)]; - } - /** * Pick a random key from the specified mapping of weight values, or return * ifEmpty if no mapping has a weight greater than 0. Each