> On 20 Jan 2017, at 09:54, Martin Buchholz <[email protected]> wrote: > >>> > (r = (long) SEED.get(t)) + GAMMA); > => > r = ((long) SEED.get(t)) + GAMMA); > or I think you can just leave them out > r = (long) SEED.get(t) + GAMMA); >
Doh, yes i see now, cross eyed! either of those two is fine. Thanks, Paul. > On Fri, Jan 20, 2017 at 9:48 AM, Paul Sandoz <[email protected] > <mailto:[email protected]>> wrote: > >> On 20 Jan 2017, at 09:45, Martin Buchholz <[email protected] >> <mailto:[email protected]>> wrote: >> >> >> >> On Fri, Jan 20, 2017 at 7:58 AM, Paul Sandoz <[email protected] >> <mailto:[email protected]>> wrote: >> >>> I was surprised to see below a change in parentheses that seems to change >>> the behavior. >>> >>> final long nextSeed() { >>> Thread t; long r; // read and update per-thread seed >>> - SEED.set(t = Thread.currentThread(), >>> - (r = (long) SEED.get(t)) + GAMMA); >>> + U.putLong(t = Thread.currentThread(), SEED, >>> + r = U.getLong(t, SEED) + GAMMA); >>> return r; >>> } >> >> The update reverted to the previous code: >> >> http://hg.openjdk.java.net/jdk9/dev/jdk/file/7901a13a051c/src/java.base/share/classes/java/util/concurrent/ThreadLocalRandom.java >> >> <http://hg.openjdk.java.net/jdk9/dev/jdk/file/7901a13a051c/src/java.base/share/classes/java/util/concurrent/ThreadLocalRandom.java> >> >> I added the parentheses to bound the cast. >> >> It still looks to me like the parenthesis got added to the wrong place (in >> the previous changeset!), > > What place do you think they should be? > > Paul. >
