There is something about SecureRandom
that i don't quiet understand. Take for example this code here:
import java.security.SecureRandom;
import java.math.BigInteger;
public final class SessionIdentifierGenerator{
private static SecureRandom random = new SecureRandom();
public static void main(String[] args) {
nextSessionId();
}
public static String nextSessionId(){
BigInteger ss = new BigInteger(130, random);
System.out.println(ss);
System.out.println(ss.toString(32));
return null;
}
}
one Example of the out put it will be:
1107894191825737787218556533052298445977
q1fikf1m0jagvlrmbtdah0mh4p
Since BigInteger
is integers the output is quiet predictable, but the thing i don't understand is where is that random string coming from since i apply toString()
method, so i was expentiong that this string it will be the same number sequence but as a string, so how and why is this happing?
thanks. ps: i don't if it has been ask before, but i didn't find anything... original code wiki