Hello,
I am having problems taking in a string (a persons name), and getting back a unique integer, it keeps going through the catch function, and I dont know why, other than the way I wrote SecureRandom is not working, but it is very confusing. I am very new to programming so please be kind!
public static int uinqueID(String name){
try{
SecureRandom srA = SecureRandom.getInstance(name);
Integer randomA = new Integer(srA.nextInt());
System.out.println(randomA);
UUID uuidA = UUID.randomUUID();
String randomNum2 = uuidA.toString();
System.out.println(randomNum2);
int randomB = Integer.valueOf(randomNum2);
int uniqueID = randomA + randomB;
return uniqueID;
} catch(NoSuchAlgorithmException e) {
System.err.println("I failed");
}
return -1;
}
The output I am getting is: I failed -1
Thank you for your help!