UUID: It stands for Universally Unique IDentifier. It is a representation of a 128-bit(16 bytes) number as hexadecimal. 6 bits are set in this version of UUID, leaving 122 bits to be random. Method of generating the UUID: First, 16 bytes(represented as decimal numbers 0-255) are randomly generated then converted into hexadecimal using a subroutine program(found inside this project). Each byte is added to a list. Then, byte 7 is selected and its first digit is altered to a '4'. Next, byte 9 is selected, and if its first digit is already an '8', '9', 'a', or 'b', the program will stop altering bits. If not, a random bit either 8, 9, a, or b will be replacing it. Then, hyphens are added and the resulting UUID is stored in a variable, where it is then added to the UUIDs list you see on screen. The probability of collision of two UUIDs is 1/(2^122), or 1/5316911983139663491615228241121378304(5.32 trillion trillion trillion) or about 0.000000000000000000000000000000000000188%, close enough to be called negligible(although not zero).
Important Note: Version 4 does NOT refer to the version of this project. It refers to the type of UUID generated. Only the version 4 UUID is randomly generated. How this UUID is RFC 4122 compliant: In this UUID Generator, 6 bits are set and 122 bits are random. The first four bits that are set is the first digit in the 3rd partition of the UUID. This is always set to 4. In binary, this is: 0100. None of these bits are changed. The other two bits are set in the first digit off the 4th partition of the UUID. Note that this is ALWAYS an 8, 9, a, or b. If we take the decimal and the binary representation of these digits, we get: 8 (8) = 1 0 0 0 9 (9) = 1 0 0 1 a (10)= 1 0 1 0 b (11)= 1 0 1 1 Notice that the first two bits are set to 1 and 0, respectively. The final two bits can change. Thus the binary representation of the UUID will be: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX-XXXXXXXXXXXXXXXX-0100XXXXXXXXXXXX-10XXXXXXXXXXXXXX-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX, where X is a "don't care bit". For example, the UUID 26bd5dd6-1c16-48b0-a459-d5e61125c046 will be represented in binary as: 00100110101111010101110111010110-0001110000010110-"0100"100010110000-"10"10010001011001-110101011110011000010001001001011100000001000110 The bits in quotes are the bits that never change when generating a RFC 4122 compliant v4 UUID. Without extra symbols this UUID in binary is: 00100110101111010101110111010110000111000001011001001000101100001010010001011001110101011110011000010001001001011100000001000110