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; }
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); }
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); }
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); }