Code example for SecureRandom

0
public class UniqId { 
    private final Log log = LogFactory.getLog(UniqId.class);
    private static char[] digits = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' };
    private static UniqId me = new UniqId();
    private String hostAddr;
    private final Random random = new SecureRandom();
    private MessageDigest mHasher;
    private final UniqTimer timer = new UniqTimer();
 
    private final ReentrantLock opLock = new ReentrantLock();
 
 
    private UniqId() { 
        try { 
            final InetAddress addr = InetAddress.getLocalHost();
 
            hostAddr = addr.getHostAddress();
        } 
        catch (final IOException e) {
            log.error("[UniqID] Get HostAddr Error", e);
            hostAddr = String.valueOf(System.currentTimeMillis());