25 |
|
|
26 |
|
package java.util; |
27 |
|
|
28 |
– |
import java.security.SecureRandom; |
28 |
|
import java.net.NetworkInterface; |
30 |
– |
import java.util.Enumeration; |
29 |
|
import java.util.concurrent.atomic.AtomicLong; |
30 |
|
import java.util.function.IntConsumer; |
31 |
|
import java.util.function.LongConsumer; |
87 |
|
* @author Doug Lea |
88 |
|
* @since 1.8 |
89 |
|
*/ |
90 |
< |
public class SplittableRandom { |
90 |
> |
public final class SplittableRandom { |
91 |
|
|
92 |
|
/* |
93 |
|
* Implementation Overview. |
240 |
|
long h = 0L; |
241 |
|
try { |
242 |
|
Enumeration<NetworkInterface> ifcs = |
243 |
< |
NetworkInterface.getNetworkInterfaces(); |
243 |
> |
NetworkInterface.getNetworkInterfaces(); |
244 |
|
boolean retry = false; // retry once if getHardwareAddress is null |
245 |
|
while (ifcs.hasMoreElements()) { |
246 |
|
NetworkInterface ifc = ifcs.nextElement(); |
402 |
|
* may, and typically does, vary across program invocations. |
403 |
|
*/ |
404 |
|
public SplittableRandom() { // emulate defaultGen.split() |
405 |
< |
long s = defaultGen.getAndAdd(2*GOLDEN_GAMMA); |
405 |
> |
long s = defaultGen.getAndAdd(2 * GOLDEN_GAMMA); |
406 |
|
this.seed = mix64(s); |
407 |
|
this.gamma = mixGamma(s + GOLDEN_GAMMA); |
408 |
|
} |