@param min inclusive @param max exclusive @return
(long min, long max)
| 92 | * @return |
| 93 | */ |
| 94 | private BigDecimal decimalBetween(long min, long max) { |
| 95 | if (min == max) { |
| 96 | return new BigDecimal(min); |
| 97 | } |
| 98 | final long trueMin = Math.min(min, max); |
| 99 | final long trueMax = Math.max(min, max); |
| 100 | |
| 101 | final double range = (double) trueMax - (double) trueMin; |
| 102 | |
| 103 | final double chunkCount = Math.sqrt(Math.abs(range)); |
| 104 | final double chunkSize = chunkCount; |
| 105 | final long randomChunk = faker.random().nextLong((long) chunkCount); |
| 106 | |
| 107 | final double chunkStart = trueMin + randomChunk * chunkSize; |
| 108 | final double adj = chunkSize * faker.random().nextDouble(); |
| 109 | return new BigDecimal(chunkStart + adj); |
| 110 | } |
| 111 | |
| 112 | public String digits(int count) { |
| 113 | final StringBuilder tmp = new StringBuilder(); |
no test coverage detected