Creates a psedorandom string @return Random String
()
| 119 | * @return Random String |
| 120 | */ |
| 121 | public static String randomString() |
| 122 | { |
| 123 | String result = new String(); |
| 124 | try |
| 125 | { |
| 126 | byte byteArray[] = new byte[16]; |
| 127 | SecureRandom psn1 = SecureRandom.getInstance("SHA1PRNG"); |
| 128 | psn1.setSeed(psn1.nextLong()); |
| 129 | psn1.nextBytes(byteArray); |
| 130 | BigInteger bigInt = new BigInteger(byteArray); |
| 131 | result = bigInt.toString(); |
| 132 | log.debug("Generated String = " + result); |
| 133 | } |
| 134 | catch(Exception e) |
| 135 | { |
| 136 | log.error("Random Number Error : " + e.toString()); |
| 137 | } |
| 138 | return result; |
| 139 | } |
| 140 | } |