Java 类org.apache.hadoop.hbase.util.number.RandomNumberUtils 实例源码

项目:ditb    文件:TestVLongTool.java   
@Test
public void testRoundTrips() {
  Random random = new Random();
  for (int i = 0; i < 10000; ++i) {
    long value = RandomNumberUtils.nextPositiveLong(random);
    byte[] bytes = UVLongTool.getBytes(value);
    long roundTripped = UVLongTool.getLong(bytes);
    Assert.assertEquals(value, roundTripped);
    int calculatedNumBytes = UVLongTool.numBytes(value);
    int actualNumBytes = bytes.length;
    Assert.assertEquals(actualNumBytes, calculatedNumBytes);
  }
}
项目:pbase    文件:TestVLongTool.java   
@Test
public void testRoundTrips() {
  Random random = new Random();
  for (int i = 0; i < 10000; ++i) {
    long value = RandomNumberUtils.nextPositiveLong(random);
    byte[] bytes = UVLongTool.getBytes(value);
    long roundTripped = UVLongTool.getLong(bytes);
    Assert.assertEquals(value, roundTripped);
    int calculatedNumBytes = UVLongTool.numBytes(value);
    int actualNumBytes = bytes.length;
    Assert.assertEquals(actualNumBytes, calculatedNumBytes);
  }
}
项目:HIndex    文件:TestVLongTool.java   
@Test
public void testRoundTrips() {
  Random random = new Random();
  for (int i = 0; i < 10000; ++i) {
    long value = RandomNumberUtils.nextPositiveLong(random);
    byte[] bytes = UVLongTool.getBytes(value);
    long roundTripped = UVLongTool.getLong(bytes);
    Assert.assertEquals(value, roundTripped);
    int calculatedNumBytes = UVLongTool.numBytes(value);
    int actualNumBytes = bytes.length;
    Assert.assertEquals(actualNumBytes, calculatedNumBytes);
  }
}
项目:PyroDB    文件:TestVLongTool.java   
@Test
public void testRoundTrips() {
  Random random = new Random();
  for (int i = 0; i < 10000; ++i) {
    long value = RandomNumberUtils.nextPositiveLong(random);
    byte[] bytes = UVLongTool.getBytes(value);
    long roundTripped = UVLongTool.getLong(bytes);
    Assert.assertEquals(value, roundTripped);
    int calculatedNumBytes = UVLongTool.numBytes(value);
    int actualNumBytes = bytes.length;
    Assert.assertEquals(actualNumBytes, calculatedNumBytes);
  }
}
项目:c5    文件:TestVLongTool.java   
@Test
public void testRoundTrips() {
  Random random = new Random();
  for (int i = 0; i < 10000; ++i) {
    long value = RandomNumberUtils.nextPositiveLong(random);
    byte[] bytes = UVLongTool.getBytes(value);
    long roundTripped = UVLongTool.getLong(bytes);
    Assert.assertEquals(value, roundTripped);
    int calculatedNumBytes = UVLongTool.numBytes(value);
    int actualNumBytes = bytes.length;
    Assert.assertEquals(actualNumBytes, calculatedNumBytes);
  }
}