Is Java???s random UUID unique ?

Java’s java.util.UUID represents an immutable universally unique identifier (UUID). In particular the static randomUUID() method of this class generates UUID which can be used as a unique identifier in distributed systems. But, is this UUID unique ? What are the chances that multiple calls to randomUUID() method will generate the same UUID ? What are the chances that such calls in distributed systems will result in duplicate identifiers ? Lets find out !

UUID

RFC4122 details out the complete UUID specification. A Universally Unique Identifier (UUID) represents a 128-bit value, i.e. 16 octets. Two most important fields determine the structure of UUID:

Website

Tags: Javas Random