PlanetSquires Forums

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: how are the "unique id" numbers created?  (Read 546 times)

John Montenigro

  • Guest
how are the "unique id" numbers created?
« 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?
Logged

David Kenny

  • Guest
Re: how are the "unique id" numbers created?
« Reply #1 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/:

Quote
The 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
Logged

John Montenigro

  • Guest
Re: how are the "unique id" numbers created?
« Reply #2 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!
Logged