Example #1
0
 public BigInteger randHiveBigInteger(Random r, String digitAlphabet) {
   String digits = RandomTypeUtil.getRandString(r, digitAlphabet, 1 + r.nextInt(38));
   BigInteger bigInteger = new BigInteger(digits);
   boolean negated = false;
   if (r.nextBoolean()) {
     bigInteger = bigInteger.negate();
     negated = true;
   }
   return bigInteger;
 }
Example #2
0
 public BigDecimal randHiveBigDecimalNormalRange(Random r, String digitAlphabet) {
   String digits = RandomTypeUtil.getRandString(r, digitAlphabet, 1 + r.nextInt(38));
   BigInteger bigInteger = new BigInteger(digits);
   boolean negated = false;
   if (r.nextBoolean()) {
     bigInteger = bigInteger.negate();
     negated = true;
   }
   int scale = 0 + r.nextInt(38 + 1);
   return new BigDecimal(bigInteger, scale);
 }
Example #3
0
 public BigDecimal randHiveBigDecimalFractionsOnly(Random r, String digitAlphabet) {
   int scale = 1 + r.nextInt(38 + 1);
   String digits = RandomTypeUtil.getRandString(r, digitAlphabet, 1 + r.nextInt(scale));
   BigInteger bigInteger = new BigInteger(digits);
   boolean negated = false;
   if (r.nextBoolean()) {
     bigInteger = bigInteger.negate();
     negated = true;
   }
   return new BigDecimal(bigInteger, scale);
 }
Example #4
0
 public BigDecimal randHiveBigDecimalLongTail(Random r, String digitAlphabet) {
   int scale = 0 + r.nextInt(38 + 20);
   final int maxDigits = 38 + (scale == 0 ? 0 : 20);
   String digits = RandomTypeUtil.getRandString(r, digitAlphabet, 1 + r.nextInt(maxDigits));
   BigInteger bigInteger = new BigInteger(digits);
   boolean negated = false;
   if (r.nextBoolean()) {
     bigInteger = bigInteger.negate();
     negated = true;
   }
   return new BigDecimal(bigInteger, scale);
 }