Does Data::GUID generate valid GUIDs?
guid, perl, uuid
Solution
The part that doesn't change is based on your MAC address. This is indicated by the 1 as the first digit of the 3rd group. The rest of the bits are based on the current time, which is why they don't change very much.
The numbers certainly don't need to be random. They just need to have an extremely low probability of matching another GUID. The combination of MAC address and current time (version 1 algorithm) do that fairly well, although there are other algorithms (version 4 is random, for instance).
See http://en.wikipedia.org/wiki/Globally_unique_identifier and http://en.wikipedia.org/wiki/Universally_unique_identifier
Problem
I am using Data::GUID to generate GUIDs. However, whenever I generate GUIDs in the same "session", i.e. running the script, the only numbers that change are the very front ones: ``` 3BAF1240-0573-11E4-B31C-B8EC0EDF341C 3BAF1588-0573-11E4-B31C-B8EC0EDF341C 3BAF1678-0573-11E4-B31C-B8EC0EDF341C ``` The first set of numbers is the only set that ever changes. If I run the script again, then I get slightly different numbers for the rest, but the second and third set of numbers are still the same: ``` E5D3A59C-0573-11E4-AA07-A5F15201CE1F E5D3A920-0573-11E4-AA07-A5F15201CE1F E5D3A9C0-0573-11E4-AA07-A5F15201CE1F ``` But again, the only changing values are in the very first set of numbers. This is very different from the results I've gotten when generating GUIDs in C#, and I thought that GUIDs were supposed to be random, so why do only the front set of numbers change? Is it okay for me to be using the GUIDs that are generated as GUIDs?