Ho adattato del codice con cui genero stringhe casuali per SecureRandom (che non conoscevo). Il mio sistema tira in mezzo anche altri caratteri. Vedi un po' se lo trovi differente dal tuo (ossia se ti pare più vario o che). Le stringhe con SR sono quelle sulla destra.
codice:import java.util.*; import java.security.*; public class randomtest { static Random r; static SecureRandom sr; public static void main (String[] args) { r = new Random(); sr = new SecureRandom(); int length = 8;//lunghezza della password byte[] b = new byte[length]; byte[] bs = new byte[length]; for (int i=0; i < 100; i++) { r.nextBytes(b); sr.nextBytes(bs); for (int j=0; j < length; j++) { System.out.print((char)(((int)b[j]&0xFF)%76+48)); } System.out.print("\t"); for (int j=0; j < length; j++) { System.out.print((char)(((int)bs[j]&0xFF)%76+48)); } System.out.print("\n------------------------\n"); } } }

). Le stringhe con SR sono quelle sulla destra.
Rispondi quotando