225 |
|
private static final AtomicLong defaultGen = new AtomicLong(initialSeed()); |
226 |
|
|
227 |
|
private static long initialSeed() { |
228 |
< |
String pp = java.security.AccessController.doPrivileged( |
229 |
< |
new sun.security.action.GetPropertyAction( |
230 |
< |
"java.util.secureRandomSeed")); |
231 |
< |
if (pp != null && pp.equalsIgnoreCase("true")) { |
228 |
> |
java.security.PrivilegedAction<Boolean> action = |
229 |
> |
() -> Boolean.getBoolean("java.util.secureRandomSeed"); |
230 |
> |
if (java.security.AccessController.doPrivileged(action)) { |
231 |
|
byte[] seedBytes = java.security.SecureRandom.getSeed(8); |
232 |
< |
long s = (long)(seedBytes[0]) & 0xffL; |
232 |
> |
long s = (long)seedBytes[0] & 0xffL; |
233 |
|
for (int i = 1; i < 8; ++i) |
234 |
< |
s = (s << 8) | ((long)(seedBytes[i]) & 0xffL); |
234 |
> |
s = (s << 8) | ((long)seedBytes[i] & 0xffL); |
235 |
|
return s; |
236 |
|
} |
237 |
|
return (mix64(System.currentTimeMillis()) ^ |
824 |
|
* approach. The long and double versions of this class are |
825 |
|
* identical except for types. |
826 |
|
*/ |
827 |
< |
static final class RandomIntsSpliterator implements Spliterator.OfInt { |
827 |
> |
private static final class RandomIntsSpliterator |
828 |
> |
implements Spliterator.OfInt { |
829 |
|
final SplittableRandom rng; |
830 |
|
long index; |
831 |
|
final long fence; |
880 |
|
/** |
881 |
|
* Spliterator for long streams. |
882 |
|
*/ |
883 |
< |
static final class RandomLongsSpliterator implements Spliterator.OfLong { |
883 |
> |
private static final class RandomLongsSpliterator |
884 |
> |
implements Spliterator.OfLong { |
885 |
|
final SplittableRandom rng; |
886 |
|
long index; |
887 |
|
final long fence; |
937 |
|
/** |
938 |
|
* Spliterator for double streams. |
939 |
|
*/ |
940 |
< |
static final class RandomDoublesSpliterator implements Spliterator.OfDouble { |
940 |
> |
private static final class RandomDoublesSpliterator |
941 |
> |
implements Spliterator.OfDouble { |
942 |
|
final SplittableRandom rng; |
943 |
|
long index; |
944 |
|
final long fence; |