Java ID Value Create generateId()

Here you can find the source of generateId()

Description

generate Id

License

Open Source License

Declaration

public static String generateId() 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.util.Random;

public class Main {
    static long seed = 0;

    public static String generateId() {
        long seed1 = System.currentTimeMillis();
        while (seed1 == seed)
            seed1 = System.currentTimeMillis(); // Make sure we'll don't get the
        // same seed twice
        seed = seed1;/*w  w  w  .ja v a2s . c  o  m*/
        Random r = new Random(seed);
        return Integer.toString(r.nextInt(), 16) + "-" + Integer.toString(r.nextInt(65535), 16) + "-"
                + Integer.toString(r.nextInt(65535), 16) + "-" + Integer.toString(r.nextInt(65535), 16);

    }
}

Related

  1. createID()
  2. createID()
  3. generateId()
  4. generateId()
  5. generateId()
  6. generateID(final String message)