|
UUID (Universally Unique Identifier) A globally unique identifier is a number generated on a machine that is guaranteed to be unique to all machines in the same space-time. The Ethernet card address, nanosecond time, chip ID number, and many possible numbers are used in accordance with the standards established by the Open Software Foundation (OSF). A combination of the current date and time (the first part of the UUID is time dependent, if you generate a UUID after a few seconds and a UUID is generated, the first part is different and the rest is the same), the clock Sequence, a globally unique IEEE machine identification number (if a network card is obtained from the network card, no network card is otherwise available), the only drawback of the UUID is that the resulting string is longer
UUID is a 128-bit long number, generally expressed in hexadecimal. The core idea of the algorithm is to combine the machine's network card, local time, a random number to generate the UUID. Theoretically, if a machine generates 10,000,000 UUIDs per second, it can be guaranteed (in the sense of probability) that 3240 does not repeat. As a result, everyone can create UUIDs that do not conflict with other people. In this case, you do not need to consider the name of the establishment of the database replication problems.
UUID 1.5 is a new category, in java.util, it can be used to produce a so-called globally unique ID.
Package UUID;
Import java.util.UUID;
Public class test {
Public static void main (String [] args) {
String uuid = UUID.randomUUID (). ToString ();
System.out.println (uuid);
}}
}}
Here are the results I ran three times
D0cd48ef-313a-405c-ac76-12cce5657dca
D7e1e24b-9574-4ea0-a08f-4cfa6965035f
C6b75eef-f6ca-4963-8c4f-26b72cb15eee
. |
|
|
|