1 |
|
/* |
2 |
|
* %W% %E% |
3 |
|
* |
4 |
< |
* Copyright 2006 Sun Microsystems, Inc. All rights reserved. |
4 |
> |
* Copyright 2007 Sun Microsystems, Inc. All rights reserved. |
5 |
|
* SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. |
6 |
|
*/ |
7 |
|
|
136 |
|
do { |
137 |
|
oldseed = seed.get(); |
138 |
|
nextseed = (oldseed * multiplier + addend) & mask; |
139 |
< |
} while (!seed.compareAndSet(oldseed, nextseed)); |
139 |
> |
} while (!seed.weakCompareAndSet(oldseed, nextseed)); |
140 |
|
return (int)(nextseed >>> (48 - bits)); |
141 |
|
} |
142 |
|
|
523 |
|
try { |
524 |
|
seedOffset = unsafe.objectFieldOffset |
525 |
|
(Random.class.getDeclaredField("seed")); |
526 |
< |
} catch (Exception ex) { throw new Error(ex); } |
526 |
> |
} catch (Exception ex) { throw new Error(ex); } |
527 |
|
} |
528 |
|
private void resetSeed(long seedVal) { |
529 |
|
unsafe.putObjectVolatile(this, seedOffset, new AtomicLong(seedVal)); |
530 |
|
} |
531 |
– |
|
531 |
|
} |