1 |
|
/* |
2 |
|
* Written by Doug Lea with assistance from members of JCP JSR-166 |
3 |
|
* Expert Group and released to the public domain, as explained at |
4 |
< |
* http://creativecommons.org/licenses/publicdomain |
4 |
> |
* http://creativecommons.org/publicdomain/zero/1.0/ |
5 |
|
*/ |
6 |
|
|
7 |
|
import java.util.*; |
148 |
|
int position; |
149 |
|
int total; |
150 |
|
|
151 |
< |
Runner(int id, Map<String,String> map, String[] key, CyclicBarrier barrier) { |
151 |
> |
Runner(int id, Map<String,String> map, String[] key, CyclicBarrier barrier) { |
152 |
|
this.map = map; |
153 |
|
this.key = key; |
154 |
|
this.barrier = barrier; |
158 |
|
} |
159 |
|
|
160 |
|
int step() { |
161 |
< |
// random-walk around key positions, bunching accesses |
161 |
> |
// random-walk around key positions, bunching accesses |
162 |
|
int r = rng.next(); |
163 |
|
position += (r & 7) - 3; |
164 |
|
while (position >= key.length) position -= key.length; |