ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/main/java/util/concurrent/ThreadLocalRandom.java
(Generate patch)

Comparing jsr166/src/main/java/util/concurrent/ThreadLocalRandom.java (file contents):
Revision 1.29 by jsr166, Thu Jun 19 17:20:41 2014 UTC vs.
Revision 1.30 by dl, Tue Dec 2 12:17:34 2014 UTC

# Line 7 | Line 7
7   package java.util.concurrent;
8  
9   import java.io.ObjectStreamField;
10 import java.net.NetworkInterface;
11 import java.util.Enumeration;
10   import java.util.Random;
11   import java.util.Spliterator;
12   import java.util.concurrent.atomic.AtomicInteger;
# Line 118 | Line 116 | public class ThreadLocalRandom extends R
116                  s = (s << 8) | ((long)(seedBytes[i]) & 0xffL);
117              return s;
118          }
119 <        long h = 0L;
122 <        try {
123 <            Enumeration<NetworkInterface> ifcs =
124 <                    NetworkInterface.getNetworkInterfaces();
125 <            boolean retry = false; // retry once if getHardwareAddress is null
126 <            while (ifcs.hasMoreElements()) {
127 <                NetworkInterface ifc = ifcs.nextElement();
128 <                if (!ifc.isVirtual()) { // skip fake addresses
129 <                    byte[] bs = ifc.getHardwareAddress();
130 <                    if (bs != null) {
131 <                        int n = bs.length;
132 <                        int m = Math.min(n >>> 1, 4);
133 <                        for (int i = 0; i < m; ++i)
134 <                            h = (h << 16) ^ (bs[i] << 8) ^ bs[n-1-i];
135 <                        if (m < 4)
136 <                            h = (h << 8) ^ bs[n-1-m];
137 <                        h = mix64(h);
138 <                        break;
139 <                    }
140 <                    else if (!retry)
141 <                        retry = true;
142 <                    else
143 <                        break;
144 <                }
145 <            }
146 <        } catch (Exception ignore) {
147 <        }
148 <        return (h ^ mix64(System.currentTimeMillis()) ^
119 >        return (mix64(System.currentTimeMillis()) ^
120                  mix64(System.nanoTime()));
121      }
122  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines