Android examples for java.util:Random
get Secure Random
//package com.java2s; import java.security.SecureRandom; public class Main { public static final String RANDOM_ALGORITHM = "SHA1PRNG"; public static SecureRandom getSecureRandom() { try {//www .j a v a 2 s .co m return SecureRandom.getInstance(RANDOM_ALGORITHM, "Crypto"); } catch (Exception e) { try { return SecureRandom.getInstance(RANDOM_ALGORITHM); } catch (Exception e1) { return new SecureRandom(); } } } }