354 |
|
|
355 |
|
/** |
356 |
|
* Saves the {@code ThreadLocalRandom} to a stream (that is, serializes it). |
357 |
+ |
* @param s the stream |
358 |
|
*/ |
359 |
< |
private void writeObject(java.io.ObjectOutputStream out) |
359 |
> |
private void writeObject(java.io.ObjectOutputStream s) |
360 |
|
throws java.io.IOException { |
361 |
|
|
362 |
< |
java.io.ObjectOutputStream.PutField fields = out.putFields(); |
362 |
> |
java.io.ObjectOutputStream.PutField fields = s.putFields(); |
363 |
|
fields.put("rnd", UNSAFE.getLong(Thread.currentThread(), SEED)); |
364 |
|
fields.put("initialized", true); |
365 |
< |
out.writeFields(); |
365 |
> |
s.writeFields(); |
366 |
|
} |
367 |
|
|
368 |
|
/** |
369 |
|
* Returns the {@link #current() current} thread's {@code ThreadLocalRandom}. |
370 |
+ |
* @return the {@link #current() current} thread's {@code ThreadLocalRandom} |
371 |
|
*/ |
372 |
|
private Object readResolve() { |
373 |
|
return current(); |