PlanetSquires Forums

Support Forums => Other Software and Code => Topic started by: John Montenigro on February 11, 2009, 07:57:26 AM

Title: how are the "unique id" numbers created?
Post by: John Montenigro on February 11, 2009, 07:57:26 AM
In various places, I've seen the use of "unique" numbers, such as in the Custom Control's .CTL file:

uniqueid        = {6A726F42-5F65-6270-764C-697374202020}

My question is, how are these numbers generated? How do we know they're unique?
Title: Re: how are the "unique id" numbers created?
Post by: David Kenny on February 11, 2009, 11:59:16 AM
You can use the PB GUID$ function to generate one. It cannot be guaranteed to be unique, but is is instead said to be "statistically unique". It is such a large number that it is very unlikely that even randomly picking billions, you will get two of the same number.

Stolen from http://betterexplained.com/articles/the-quick-guide-to-guids/ (http://betterexplained.com/articles/the-quick-guide-to-guids/):

QuoteThe Great GUID Shortage

When learning about GUIDs, it feels like 38 measly digits aren’t enough. Won’t we run out if people get GUID-crazy, assigning them for everything from their pets to their favorite bubble gum flavor?

Let’s see. Think about how big the Internet is: Google has billions of web pages in its index. Let’s call it a trillion (10^12) for kicks. Think about every wikipedia article, every news item on CNN, every product in Amazon, every blog post from any author. We can assign a GUID for each of these documents.

Now let’s say everyone on Earth gets their own copy of the internet, to keep track of their stuff. Even crazier, let’s say each person gets their own copy of the internet every second. How long can we go on?

Over a billion years.

Let me say that again. Each person gets a personal copy of the internet, every second, for a billion years.

It’s a mind-boggling amount of items, and it’s hard to get our heads around it. Trust me, we won’t run out of GUIDs anytime soon. And if we do? We’ll start using GUIDs with more digits.

Hope that helps,

David
Title: Re: how are the "unique id" numbers created?
Post by: John Montenigro on February 12, 2009, 11:46:16 AM
The article is a great intro - gives a good background for the PB helpfile's GUID$ entry.

Very helpful, thanks!