| 4 | import java.util.Random; |
| 5 | |
| 6 | public class RandomUtils extends org.apache.commons.lang3.RandomUtils { |
| 7 | |
| 8 | private static final char[] CODE_SEQ = { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', |
| 9 | 'K', 'L', 'M', 'N', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', |
| 10 | 'X', 'Y', 'Z', '2', '3', '4', '5', '6', '7', '8', '9' }; |
| 11 | |
| 12 | private static final char[] NUMBER_ARRAY = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' }; |
| 13 | |
| 14 | private static Random random = new Random(); |
| 15 | |
| 16 | public static String randomString(int length) { |
| 17 | StringBuilder sb = new StringBuilder(); |
| 18 | for (int i = 0; i < length; i++) { |
| 19 | sb.append(String.valueOf(CODE_SEQ[random.nextInt(CODE_SEQ.length)])); |
| 20 | } |
| 21 | return sb.toString(); |
| 22 | } |
| 23 | |
| 24 | public static String randomNumberString(int length) { |
| 25 | StringBuilder sb = new StringBuilder(); |
| 26 | for (int i = 0; i < length; i++) { |
| 27 | sb.append(String.valueOf(NUMBER_ARRAY[random.nextInt(NUMBER_ARRAY.length)])); |
| 28 | } |
| 29 | return sb.toString(); |
| 30 | } |
| 31 | |
| 32 | public static Color randomColor(int fc, int bc) { |
| 33 | int f = fc; |
| 34 | int b = bc; |
| 35 | Random random = new Random(); |
| 36 | if (f > 255) { |
| 37 | f = 255; |
| 38 | } |
| 39 | if (b > 255) { |
| 40 | b = 255; |
| 41 | } |
| 42 | return new Color(f + random.nextInt(b - f), f + random.nextInt(b - f), f + random.nextInt(b - f)); |
| 43 | } |
| 44 | |
| 45 | public static int nextInt(int bound) { |
| 46 | return random.nextInt(bound); |
| 47 | } |
| 48 | } |
nothing calls this directly
no outgoing calls
no test coverage detected