1 |
|
/* |
2 |
|
* %W% %E% |
3 |
|
* |
4 |
< |
* Copyright 2003 Sun Microsystems, Inc. All rights reserved. |
4 |
> |
* Copyright 2004 Sun Microsystems, Inc. All rights reserved. |
5 |
|
* SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. |
6 |
|
*/ |
7 |
|
|
134 |
|
*/ |
135 |
|
protected int next(int bits) { |
136 |
|
long oldseed, nextseed; |
137 |
+ |
AtomicLong seed = this.seed; |
138 |
|
do { |
139 |
< |
oldseed = seed.get(); |
140 |
< |
nextseed = (oldseed * multiplier + addend) & mask; |
139 |
> |
oldseed = seed.get(); |
140 |
> |
nextseed = (oldseed * multiplier + addend) & mask; |
141 |
|
} while (!seed.compareAndSet(oldseed, nextseed)); |
142 |
|
return (int)(nextseed >>> (48 - bits)); |
143 |
|
} |