Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. The Proof that a GUID is not unique

The Proof that a GUID is not unique

Scheduled Pinned Locked Moved The Lounge
questioncomalgorithmsperformance
43 Posts 30 Posters 27 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Marco Bertschi
    wrote on last edited by
    #1

    Searching for the number of possible GUIDs (answering questions in the forum section) I struggled over this amusing SO Thread where they are seriously discussing how the non-unique nature of a GUID can be proofed. Enjoy[^] Edit -> Here is my answer to the said question (can you think of a creative one yourself?):

    Quote:

    A Guid is 128 bit. Therefore you would have to generate 2^128 + 1 GUIDs to encounter a single GUID twice. A thread on StackOverflow.com[^] says that you would need about 10790283070806014188970 years to encounter a single GUID twice, assuming your program does nothing else than creating GUIDs and runs at a processor speed of 1 GhZ, without any interruption by CPU power eaten by other programs or the operating system itself. As you probably can think now, encountering the same GUID twice would be very bad luck and can safely considered as being unrealistic.

    People becoming wiser in order to notice the stupid things they did back in the young days. This doesn't mean that they really stop doing those things. Wise people still do stupid things, only on purpose.

    N M Kornfeld Eliyahu PeterK N L 15 Replies Last reply
    0
    • M Marco Bertschi

      Searching for the number of possible GUIDs (answering questions in the forum section) I struggled over this amusing SO Thread where they are seriously discussing how the non-unique nature of a GUID can be proofed. Enjoy[^] Edit -> Here is my answer to the said question (can you think of a creative one yourself?):

      Quote:

      A Guid is 128 bit. Therefore you would have to generate 2^128 + 1 GUIDs to encounter a single GUID twice. A thread on StackOverflow.com[^] says that you would need about 10790283070806014188970 years to encounter a single GUID twice, assuming your program does nothing else than creating GUIDs and runs at a processor speed of 1 GhZ, without any interruption by CPU power eaten by other programs or the operating system itself. As you probably can think now, encountering the same GUID twice would be very bad luck and can safely considered as being unrealistic.

      People becoming wiser in order to notice the stupid things they did back in the young days. This doesn't mean that they really stop doing those things. Wise people still do stupid things, only on purpose.

      N Offline
      N Offline
      NeverJustHere
      wrote on last edited by
      #2

      I have always argued (mostly unsuccessfully) that any system that aims to be reliable cannot depend on the uniqueness of GUIDs. There is no problem that they solve that cannot also be solved in a way that is guaranteed to be reliable (although the solution may be more complex) Sure, it may not happen, but it can happen.

      T 1 Reply Last reply
      0
      • M Marco Bertschi

        Searching for the number of possible GUIDs (answering questions in the forum section) I struggled over this amusing SO Thread where they are seriously discussing how the non-unique nature of a GUID can be proofed. Enjoy[^] Edit -> Here is my answer to the said question (can you think of a creative one yourself?):

        Quote:

        A Guid is 128 bit. Therefore you would have to generate 2^128 + 1 GUIDs to encounter a single GUID twice. A thread on StackOverflow.com[^] says that you would need about 10790283070806014188970 years to encounter a single GUID twice, assuming your program does nothing else than creating GUIDs and runs at a processor speed of 1 GhZ, without any interruption by CPU power eaten by other programs or the operating system itself. As you probably can think now, encountering the same GUID twice would be very bad luck and can safely considered as being unrealistic.

        People becoming wiser in order to notice the stupid things they did back in the young days. This doesn't mean that they really stop doing those things. Wise people still do stupid things, only on purpose.

        M Offline
        M Offline
        Mark_Wallace
        wrote on last edited by
        #3

        Marco Bertschi wrote:

        A Guid is 128 bit. Therefore you would have to generate at most 2^128 + 1 GUIDs to encounter a single GUID twice.

        I thought developers were supposed to be logical! Your statement screams "Does not compute, Will Robinson!" at me! The minimum, of course, is two.

        I wanna be a eunuchs developer! Pass me a bread knife!

        OriginalGriffO 1 Reply Last reply
        0
        • M Mark_Wallace

          Marco Bertschi wrote:

          A Guid is 128 bit. Therefore you would have to generate at most 2^128 + 1 GUIDs to encounter a single GUID twice.

          I thought developers were supposed to be logical! Your statement screams "Does not compute, Will Robinson!" at me! The minimum, of course, is two.

          I wanna be a eunuchs developer! Pass me a bread knife!

          OriginalGriffO Offline
          OriginalGriffO Offline
          OriginalGriff
          wrote on last edited by
          #4

          Or, of coutrse he could have said

          Marco Bertschi wrote:

          A Guid is 128 bit. Therefore you would have to generate 2^128 + 1 GUIDs to guarantee encounter**ing** a single GUID twice.

          The only instant messaging I do involves my middle finger. English doesn't borrow from other languages. English follows other languages down dark alleys, knocks them over and goes through their pockets for loose grammar.

          "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
          "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

          S 1 Reply Last reply
          0
          • OriginalGriffO OriginalGriff

            Or, of coutrse he could have said

            Marco Bertschi wrote:

            A Guid is 128 bit. Therefore you would have to generate 2^128 + 1 GUIDs to guarantee encounter**ing** a single GUID twice.

            The only instant messaging I do involves my middle finger. English doesn't borrow from other languages. English follows other languages down dark alleys, knocks them over and goes through their pockets for loose grammar.

            S Offline
            S Offline
            Septimus Hedgehog
            wrote on last edited by
            #5

            While you smart arses are arguing the toss I've just seen another duplicate GUID pass by. :)

            If there is one thing more dangerous than getting between a bear and her cubs it's getting between my wife and her chocolate.

            M OriginalGriffO H 3 Replies Last reply
            0
            • S Septimus Hedgehog

              While you smart arses are arguing the toss I've just seen another duplicate GUID pass by. :)

              If there is one thing more dangerous than getting between a bear and her cubs it's getting between my wife and her chocolate.

              M Offline
              M Offline
              Mark_Wallace
              wrote on last edited by
              #6

              Did it include the characters S, S, N, N, L, L, L, I, I, E, E, E, and E?

              I wanna be a eunuchs developer! Pass me a bread knife!

              S 1 Reply Last reply
              0
              • M Marco Bertschi

                Searching for the number of possible GUIDs (answering questions in the forum section) I struggled over this amusing SO Thread where they are seriously discussing how the non-unique nature of a GUID can be proofed. Enjoy[^] Edit -> Here is my answer to the said question (can you think of a creative one yourself?):

                Quote:

                A Guid is 128 bit. Therefore you would have to generate 2^128 + 1 GUIDs to encounter a single GUID twice. A thread on StackOverflow.com[^] says that you would need about 10790283070806014188970 years to encounter a single GUID twice, assuming your program does nothing else than creating GUIDs and runs at a processor speed of 1 GhZ, without any interruption by CPU power eaten by other programs or the operating system itself. As you probably can think now, encountering the same GUID twice would be very bad luck and can safely considered as being unrealistic.

                People becoming wiser in order to notice the stupid things they did back in the young days. This doesn't mean that they really stop doing those things. Wise people still do stupid things, only on purpose.

                Kornfeld Eliyahu PeterK Offline
                Kornfeld Eliyahu PeterK Offline
                Kornfeld Eliyahu Peter
                wrote on last edited by
                #7

                With GUID we talk about probability not certainty. Even we have a GUID generator that really generates unique id, at the moment we run it in multiply locations we lost event the theory of uniqueness...

                I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is (V).

                "It never ceases to amaze me that a spacecraft launched in 1977 can be fixed remotely from Earth." ― Brian Cox

                1 Reply Last reply
                0
                • M Marco Bertschi

                  Searching for the number of possible GUIDs (answering questions in the forum section) I struggled over this amusing SO Thread where they are seriously discussing how the non-unique nature of a GUID can be proofed. Enjoy[^] Edit -> Here is my answer to the said question (can you think of a creative one yourself?):

                  Quote:

                  A Guid is 128 bit. Therefore you would have to generate 2^128 + 1 GUIDs to encounter a single GUID twice. A thread on StackOverflow.com[^] says that you would need about 10790283070806014188970 years to encounter a single GUID twice, assuming your program does nothing else than creating GUIDs and runs at a processor speed of 1 GhZ, without any interruption by CPU power eaten by other programs or the operating system itself. As you probably can think now, encountering the same GUID twice would be very bad luck and can safely considered as being unrealistic.

                  People becoming wiser in order to notice the stupid things they did back in the young days. This doesn't mean that they really stop doing those things. Wise people still do stupid things, only on purpose.

                  N Offline
                  N Offline
                  Nicholas Marty
                  wrote on last edited by
                  #8

                  I still try discourage everyone from using GUID's if it's not truly necessary. 1. Waste of disk space, if an 32bit integer is sufficient why use a GUID? 2. Waste of processing power, more expensive to create, more expensive to compare against etc. 3. GUID is way more difficult to read for humans Sure there are uses for it but in most cases you're perfectly fine without them.

                  P L 2 Replies Last reply
                  0
                  • M Marco Bertschi

                    Searching for the number of possible GUIDs (answering questions in the forum section) I struggled over this amusing SO Thread where they are seriously discussing how the non-unique nature of a GUID can be proofed. Enjoy[^] Edit -> Here is my answer to the said question (can you think of a creative one yourself?):

                    Quote:

                    A Guid is 128 bit. Therefore you would have to generate 2^128 + 1 GUIDs to encounter a single GUID twice. A thread on StackOverflow.com[^] says that you would need about 10790283070806014188970 years to encounter a single GUID twice, assuming your program does nothing else than creating GUIDs and runs at a processor speed of 1 GhZ, without any interruption by CPU power eaten by other programs or the operating system itself. As you probably can think now, encountering the same GUID twice would be very bad luck and can safely considered as being unrealistic.

                    People becoming wiser in order to notice the stupid things they did back in the young days. This doesn't mean that they really stop doing those things. Wise people still do stupid things, only on purpose.

                    L Offline
                    L Offline
                    Lost User
                    wrote on last edited by
                    #9

                    It's a random number from a limited domain. Ask enough numbers, and you'll encounter the same number sooner or later - one doesn't need much math to explain the logic.

                    Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^]

                    S 1 Reply Last reply
                    0
                    • M Marco Bertschi

                      Searching for the number of possible GUIDs (answering questions in the forum section) I struggled over this amusing SO Thread where they are seriously discussing how the non-unique nature of a GUID can be proofed. Enjoy[^] Edit -> Here is my answer to the said question (can you think of a creative one yourself?):

                      Quote:

                      A Guid is 128 bit. Therefore you would have to generate 2^128 + 1 GUIDs to encounter a single GUID twice. A thread on StackOverflow.com[^] says that you would need about 10790283070806014188970 years to encounter a single GUID twice, assuming your program does nothing else than creating GUIDs and runs at a processor speed of 1 GhZ, without any interruption by CPU power eaten by other programs or the operating system itself. As you probably can think now, encountering the same GUID twice would be very bad luck and can safely considered as being unrealistic.

                      People becoming wiser in order to notice the stupid things they did back in the young days. This doesn't mean that they really stop doing those things. Wise people still do stupid things, only on purpose.

                      C Offline
                      C Offline
                      Captain Price
                      wrote on last edited by
                      #10

                      That's why I don't use GUIDs. :-D

                      "If A is a success in life, then A=x+y+z. (Work is x; y is play; and z is keeping your mouth shut.)"

                      1 Reply Last reply
                      0
                      • M Marco Bertschi

                        Searching for the number of possible GUIDs (answering questions in the forum section) I struggled over this amusing SO Thread where they are seriously discussing how the non-unique nature of a GUID can be proofed. Enjoy[^] Edit -> Here is my answer to the said question (can you think of a creative one yourself?):

                        Quote:

                        A Guid is 128 bit. Therefore you would have to generate 2^128 + 1 GUIDs to encounter a single GUID twice. A thread on StackOverflow.com[^] says that you would need about 10790283070806014188970 years to encounter a single GUID twice, assuming your program does nothing else than creating GUIDs and runs at a processor speed of 1 GhZ, without any interruption by CPU power eaten by other programs or the operating system itself. As you probably can think now, encountering the same GUID twice would be very bad luck and can safely considered as being unrealistic.

                        People becoming wiser in order to notice the stupid things they did back in the young days. This doesn't mean that they really stop doing those things. Wise people still do stupid things, only on purpose.

                        R Offline
                        R Offline
                        Rage
                        wrote on last edited by
                        #11

                        It must be unique, because it has "unique" in the name. Otherwise, it would have been a GNUID. And anyway, I don't think the Internet would be lying at us like that.

                        ~RaGE();

                        I think words like 'destiny' are a way of trying to find order where none exists. - Christian Graus Do not feed the troll ! - Common proverb

                        Z 1 Reply Last reply
                        0
                        • S Septimus Hedgehog

                          While you smart arses are arguing the toss I've just seen another duplicate GUID pass by. :)

                          If there is one thing more dangerous than getting between a bear and her cubs it's getting between my wife and her chocolate.

                          OriginalGriffO Offline
                          OriginalGriffO Offline
                          OriginalGriff
                          wrote on last edited by
                          #12

                          You sure? They are a lot like snowflakes: if you look at the fine detail they aren't the same. :laugh:

                          The only instant messaging I do involves my middle finger. English doesn't borrow from other languages. English follows other languages down dark alleys, knocks them over and goes through their pockets for loose grammar.

                          "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
                          "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

                          Z M 2 Replies Last reply
                          0
                          • M Marco Bertschi

                            Searching for the number of possible GUIDs (answering questions in the forum section) I struggled over this amusing SO Thread where they are seriously discussing how the non-unique nature of a GUID can be proofed. Enjoy[^] Edit -> Here is my answer to the said question (can you think of a creative one yourself?):

                            Quote:

                            A Guid is 128 bit. Therefore you would have to generate 2^128 + 1 GUIDs to encounter a single GUID twice. A thread on StackOverflow.com[^] says that you would need about 10790283070806014188970 years to encounter a single GUID twice, assuming your program does nothing else than creating GUIDs and runs at a processor speed of 1 GhZ, without any interruption by CPU power eaten by other programs or the operating system itself. As you probably can think now, encountering the same GUID twice would be very bad luck and can safely considered as being unrealistic.

                            People becoming wiser in order to notice the stupid things they did back in the young days. This doesn't mean that they really stop doing those things. Wise people still do stupid things, only on purpose.

                            G Offline
                            G Offline
                            Gregory Gadow
                            wrote on last edited by
                            #13

                            There is a finite number of possible values for a GUID. No finite number can be guaranteed unique. It's not that difficult.

                            1 Reply Last reply
                            0
                            • M Marco Bertschi

                              Searching for the number of possible GUIDs (answering questions in the forum section) I struggled over this amusing SO Thread where they are seriously discussing how the non-unique nature of a GUID can be proofed. Enjoy[^] Edit -> Here is my answer to the said question (can you think of a creative one yourself?):

                              Quote:

                              A Guid is 128 bit. Therefore you would have to generate 2^128 + 1 GUIDs to encounter a single GUID twice. A thread on StackOverflow.com[^] says that you would need about 10790283070806014188970 years to encounter a single GUID twice, assuming your program does nothing else than creating GUIDs and runs at a processor speed of 1 GhZ, without any interruption by CPU power eaten by other programs or the operating system itself. As you probably can think now, encountering the same GUID twice would be very bad luck and can safely considered as being unrealistic.

                              People becoming wiser in order to notice the stupid things they did back in the young days. This doesn't mean that they really stop doing those things. Wise people still do stupid things, only on purpose.

                              L Offline
                              L Offline
                              Lost User
                              wrote on last edited by
                              #14

                              If you're only talking about the random GUIDs, only 122 bits are actually random.

                              1 Reply Last reply
                              0
                              • OriginalGriffO OriginalGriff

                                You sure? They are a lot like snowflakes: if you look at the fine detail they aren't the same. :laugh:

                                The only instant messaging I do involves my middle finger. English doesn't borrow from other languages. English follows other languages down dark alleys, knocks them over and goes through their pockets for loose grammar.

                                Z Offline
                                Z Offline
                                ZurdoDev
                                wrote on last edited by
                                #15

                                Quote:

                                They are a lot like snowflakes:

                                Funny you bring that up. Recently a scientist claimed to have found many duplicates after cataloging many, many snowflakes. Of course they aren't unique.

                                There are only 10 types of people in the world, those who understand binary and those who don't.

                                S 1 Reply Last reply
                                0
                                • M Marco Bertschi

                                  Searching for the number of possible GUIDs (answering questions in the forum section) I struggled over this amusing SO Thread where they are seriously discussing how the non-unique nature of a GUID can be proofed. Enjoy[^] Edit -> Here is my answer to the said question (can you think of a creative one yourself?):

                                  Quote:

                                  A Guid is 128 bit. Therefore you would have to generate 2^128 + 1 GUIDs to encounter a single GUID twice. A thread on StackOverflow.com[^] says that you would need about 10790283070806014188970 years to encounter a single GUID twice, assuming your program does nothing else than creating GUIDs and runs at a processor speed of 1 GhZ, without any interruption by CPU power eaten by other programs or the operating system itself. As you probably can think now, encountering the same GUID twice would be very bad luck and can safely considered as being unrealistic.

                                  People becoming wiser in order to notice the stupid things they did back in the young days. This doesn't mean that they really stop doing those things. Wise people still do stupid things, only on purpose.

                                  P Offline
                                  P Offline
                                  peterchen
                                  wrote on last edited by
                                  #16

                                  Only it's not really 128 "random" bits[^]. For example, time value will roll over at less than 1400 years.

                                  ORDER BY what user wants

                                  J 1 Reply Last reply
                                  0
                                  • R Rage

                                    It must be unique, because it has "unique" in the name. Otherwise, it would have been a GNUID. And anyway, I don't think the Internet would be lying at us like that.

                                    ~RaGE();

                                    I think words like 'destiny' are a way of trying to find order where none exists. - Christian Graus Do not feed the troll ! - Common proverb

                                    Z Offline
                                    Z Offline
                                    ZurdoDev
                                    wrote on last edited by
                                    #17

                                    :laugh: +5 Sounds like someone just got high-speed internet last month.

                                    There are only 10 types of people in the world, those who understand binary and those who don't.

                                    1 Reply Last reply
                                    0
                                    • N Nicholas Marty

                                      I still try discourage everyone from using GUID's if it's not truly necessary. 1. Waste of disk space, if an 32bit integer is sufficient why use a GUID? 2. Waste of processing power, more expensive to create, more expensive to compare against etc. 3. GUID is way more difficult to read for humans Sure there are uses for it but in most cases you're perfectly fine without them.

                                      P Offline
                                      P Offline
                                      PIEBALDconsult
                                      wrote on last edited by
                                      #18

                                      Nicholas Marty wrote:

                                      3. GUID is way more difficult to read for humans

                                      So what? IDs are meant to be meaningless; so that's a good thing. Even with integers you'll likely wind up just copying-and-pasting anyway. Or do this: 00000000-0000-0000-0000-000000000001 00000000-0000-0000-0000-000000000002 00000000-0000-0000-0000-000000000003 00000000-0000-0000-0000-000000000004 00000000-0000-0000-0000-000000000005

                                      S 1 Reply Last reply
                                      0
                                      • S Septimus Hedgehog

                                        While you smart arses are arguing the toss I've just seen another duplicate GUID pass by. :)

                                        If there is one thing more dangerous than getting between a bear and her cubs it's getting between my wife and her chocolate.

                                        H Offline
                                        H Offline
                                        Herbie Mountjoy
                                        wrote on last edited by
                                        #19

                                        Yikes! It's like encountering your doppelgänger in the street.

                                        I may not last forever but the mess I leave behind certainly will.

                                        1 Reply Last reply
                                        0
                                        • N NeverJustHere

                                          I have always argued (mostly unsuccessfully) that any system that aims to be reliable cannot depend on the uniqueness of GUIDs. There is no problem that they solve that cannot also be solved in a way that is guaranteed to be reliable (although the solution may be more complex) Sure, it may not happen, but it can happen.

                                          T Offline
                                          T Offline
                                          ThatEffinIanHarrisBloke
                                          wrote on last edited by
                                          #20

                                          Yep, I always work on the principal that a GUID may be duplicated so I add Ticks since the Epoch or something like that to my GUIDs because Ticks should only ever increase. The chances of getting the exact same ticks in milliseconds AND a duplicate GUID are not gunna happen! you're welcome :)

                                          M J 2 Replies Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • World
                                          • Users
                                          • Groups