// generate a 128-bit high quality random number, almost certainly unique import java.util.UUID; // ... UUID u = UUID.randomUUID(); out.println( u ); // prints something like 2867ac57-f109-470c-abec-124deea787e1 // timelow - timemid - timehigh+ver - variant+sequence - node // The fields have nothing to do with time in this type 4 UUID. // They only have literal time meaning for a type 1 UUID.