@param numberOfDigits the number of digits the generated value should have @param strict whether or not the generated value should have exactly numberOfDigits
(int numberOfDigits, boolean strict)
| 53 | * @param strict whether or not the generated value should have exactly <code>numberOfDigits</code> |
| 54 | */ |
| 55 | public long randomNumber(int numberOfDigits, boolean strict) { |
| 56 | long max = (long) Math.pow(10, numberOfDigits); |
| 57 | if (strict) { |
| 58 | long min = (long) Math.pow(10, numberOfDigits - 1); |
| 59 | return faker.random().nextLong(max - min) + min; |
| 60 | } |
| 61 | |
| 62 | return faker.random().nextLong(max); |
| 63 | } |
| 64 | |
| 65 | /** |
| 66 | * Returns a random number |