提交 72eaf1f6 编写于 作者: A alanb

8030690: TEST_BUG java/nio/Buffer/Chars.java fails intermittently

Reviewed-by: alanb
Contributed-by: yiming.wang@oracle.com
上级 acd5f1b7
......@@ -51,8 +51,8 @@ public class Chars {
*/
static CharBuffer randomizeRange(CharBuffer cb) {
int mid = cb.capacity() >>> 1;
int start = RAND.nextInt(mid);
int end = mid + RAND.nextInt(mid);
int start = RAND.nextInt(mid + 1); // from 0 to mid
int end = mid + RAND.nextInt(cb.capacity() - mid + 1); // from mid to capacity
cb.position(start);
cb.limit(end);
return cb;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册