On 08/09/13 11:43, Aleksey Shipilev wrote:
On 08/09/2013 04:29 PM, Doug Lea wrote:
Currently at:
http://gee.cs.oswego.edu/cgi-bin/viewcvs.cgi/jsr166/src/main/java/util/SplittableRandom.java?view=log
Looks good.
Stupid questions below:
* Why use InetAddress.getLocalHost() for the initial seed? I understand
you don't want to use SecureRandom to dodge the depleted entropy case,
(Yes. SecoreRandom can and does encounter entropy-gathering
stalls for users that we don't want to impose without a
security rationale.)
but isn't that the over-optimization to initialize the static seed once
per VM/classloader?
The hashed seed is just part of a hash forming initial seed.
It is a safeguard for the case in which all machines in
some big cluster start up with exact same currentTimeMillis
and nanoTime so have same seed. Which is extremely
unlikely to being with, but using host hash is extremely
extremely unlikely :-)
* Is there something in floating point math forcing us to use the
constructions like "if (!(origin < bound))" instead of "if (origin >=
bound)"?
Yes. It traps NaNs and the like.
-Doug