{"id":343,"date":"2014-07-20T18:31:07","date_gmt":"2014-07-21T00:31:07","guid":{"rendered":"https:\/\/tylerfindlay.com\/?p=343"},"modified":"2014-07-20T18:31:07","modified_gmt":"2014-07-21T00:31:07","slug":"are-guids-actually-unique","status":"publish","type":"post","link":"https:\/\/tylerfindlay.com\/index.php\/2014\/07\/20\/are-guids-actually-unique\/","title":{"rendered":"Are GUIDs actually unique?"},"content":{"rendered":"<p>No.<\/p>\n<p>This could potentially be the shortest blog post ever written, and the short mathematically accurate answer is \u201cno\u201d. A GUID (globally unique identifier) is a 32 character sequence of \u00a0alphanumeric (letters or numbers). They are useful to developers because, in theory when generated, no GUID like this has been generated before, nor will another be generated again.<\/p>\n<p><!--more--><\/p>\n<p>However, for anyone who understands what \u201calways forever\u201d means in math, this should immediately ring false. There is a limit to the number of GUIDs that can be generated. However, that limit has a very high ceiling, and that&#8217;s what is so fascinating about them.<\/p>\n<p>Bear with me through a little math for a moment. GUIDs are generated using 6 fixed bits and 122 random bits<sup>1<\/sup>. The fixed bits contain the version of the GUID generation algorithm being used, and previously contained the machines MAC address (though this was changed as it exposed a privacy hole where one could locate the machine a GUID was generated at). This means there are 2^122, or 5.2 x 10^36<sup>1<\/sup>, or about 5 trillion trillion trillion unique GUIDs.<\/p>\n<p>Statistically, it\u2019s a very safe assumption to expect that a generated GUID is totally unique across all systems for all time, which blows my mind. You are being provided something seemingly mathematically impossible. Something (almost) unique, but something that we can tangibly touch and view, within the confines of just 32 alphanumeric characters.<\/p>\n<p>I like to think that every time I programmatically generate a GUID that I\u2019m going to some giant reservoir at the center of the Universe that contains all GUIDs and stealing one. However, emptying this reservoir would actually be more feeble than going to the ocean<sup>2<\/sup> and trying to empty it by taking out one droplet water at a time (mathematically actually, about 200 trillion times as feeble, since by size comparison every drop of water in the ocean would represent 200 trillion GUIDs).<\/p>\n<p>Every once in awhile I stare at a list of generated test data containing GUIDs in a bit of awe. I feel a slight sense of loss when deleting that test data knowing the likelihood of any one of those exact GUIDs being generated is less likely than winning the lotto 6\/49 jackpot 5 times in a row<sup>3<\/sup>. So I commend you to all, developer or not, to respect the GUID. It is a way of glimpsing at a tiny corner of infinity, which even in this reduced format is quite a phenomenon to ponder.<\/p>\n<p>Want to take one away from the universe?<br \/>\nYou already have (refresh the page to take more): <span id=\"generatedGuid\" style=\"font-weight: bold\"><\/span><\/p>\n<p>%CODE1%<\/p>\n<p>References:<\/p>\n<p>Stack overflow for some initial inspiration, <a href=\"http:\/\/stackoverflow.com\/questions\/39771\/is-a-guid-unique-100-of-the-time\">here<\/a><\/p>\n<p>1 ^ <a href=\"http:\/\/en.wikipedia.org\/wiki\/Globally_unique_identifier\">http:\/\/en.wikipedia.org\/wiki\/Globally_unique_identifier<\/a><br \/>\n2 ^ Calculated using the oceans volume from <a href=\"http:\/\/oceanservice.noaa.gov\/facts\/oceanwater.html\">http:\/\/oceanservice.noaa.gov\/facts\/oceanwater.html<\/a><br \/>\n3 ^ Calculated using the probability referenced at <a href=\"http:\/\/www.moneysense.ca\/spend\/how-to-win-the-lottery-2\">http:\/\/www.moneysense.ca\/spend\/how-to-win-the-lottery-2<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>No. This could potentially be the shortest blog post ever written, and the short mathematically accurate answer is \u201cno\u201d. A GUID (globally unique identifier) is a 32 character sequence of \u00a0alphanumeric (letters or numbers). They are useful to developers because, in theory when generated, no GUID like this has been generated before, nor will another [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[15],"tags":[32,35,47,61,65],"class_list":["post-343","post","type-post","status-publish","format-standard","hentry","category-technology","tag-computers","tag-development","tag-math","tag-science","tag-technology-2"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v19.11 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Are GUIDs actually unique? - Tyler Findlay<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/tylerfindlay.com\/index.php\/2014\/07\/20\/are-guids-actually-unique\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Are GUIDs actually unique? - Tyler Findlay\" \/>\n<meta property=\"og:description\" content=\"No. This could potentially be the shortest blog post ever written, and the short mathematically accurate answer is \u201cno\u201d. A GUID (globally unique identifier) is a 32 character sequence of \u00a0alphanumeric (letters or numbers). They are useful to developers because, in theory when generated, no GUID like this has been generated before, nor will another [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/tylerfindlay.com\/index.php\/2014\/07\/20\/are-guids-actually-unique\/\" \/>\n<meta property=\"og:site_name\" content=\"Tyler Findlay\" \/>\n<meta property=\"article:published_time\" content=\"2014-07-21T00:31:07+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/tylerfindlay.com\/index.php\/2014\/07\/20\/are-guids-actually-unique\/\",\"url\":\"https:\/\/tylerfindlay.com\/index.php\/2014\/07\/20\/are-guids-actually-unique\/\",\"name\":\"Are GUIDs actually unique? - Tyler Findlay\",\"isPartOf\":{\"@id\":\"https:\/\/tylerfindlay.com\/#website\"},\"datePublished\":\"2014-07-21T00:31:07+00:00\",\"dateModified\":\"2014-07-21T00:31:07+00:00\",\"author\":{\"@id\":\"https:\/\/tylerfindlay.com\/#\/schema\/person\/53a67884f40536baaa37a6e37e404273\"},\"breadcrumb\":{\"@id\":\"https:\/\/tylerfindlay.com\/index.php\/2014\/07\/20\/are-guids-actually-unique\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/tylerfindlay.com\/index.php\/2014\/07\/20\/are-guids-actually-unique\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/tylerfindlay.com\/index.php\/2014\/07\/20\/are-guids-actually-unique\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/tylerfindlay.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Are GUIDs actually unique?\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/tylerfindlay.com\/#website\",\"url\":\"https:\/\/tylerfindlay.com\/\",\"name\":\"Tyler Findlay\",\"description\":\"Computer Scientist. Perpetual Vagabond. Technology whore. Leadership enthusiast. Liker of funny stuff. Would make an outstanding Jedi.\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/tylerfindlay.com\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/tylerfindlay.com\/#\/schema\/person\/53a67884f40536baaa37a6e37e404273\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/tylerfindlay.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/e964dc4307e6f3c229ac696c302fd293754245cc427c34e375eab35ec671b5d6?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/e964dc4307e6f3c229ac696c302fd293754245cc427c34e375eab35ec671b5d6?s=96&d=mm&r=g\",\"caption\":\"admin\"},\"sameAs\":[\"https:\/\/temp.tylerfindlay.com\"],\"url\":\"https:\/\/tylerfindlay.com\/index.php\/author\/tyler_d1ogunpg\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Are GUIDs actually unique? - Tyler Findlay","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/tylerfindlay.com\/index.php\/2014\/07\/20\/are-guids-actually-unique\/","og_locale":"en_US","og_type":"article","og_title":"Are GUIDs actually unique? - Tyler Findlay","og_description":"No. This could potentially be the shortest blog post ever written, and the short mathematically accurate answer is \u201cno\u201d. A GUID (globally unique identifier) is a 32 character sequence of \u00a0alphanumeric (letters or numbers). They are useful to developers because, in theory when generated, no GUID like this has been generated before, nor will another [&hellip;]","og_url":"https:\/\/tylerfindlay.com\/index.php\/2014\/07\/20\/are-guids-actually-unique\/","og_site_name":"Tyler Findlay","article_published_time":"2014-07-21T00:31:07+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"Written by":"admin","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/tylerfindlay.com\/index.php\/2014\/07\/20\/are-guids-actually-unique\/","url":"https:\/\/tylerfindlay.com\/index.php\/2014\/07\/20\/are-guids-actually-unique\/","name":"Are GUIDs actually unique? - Tyler Findlay","isPartOf":{"@id":"https:\/\/tylerfindlay.com\/#website"},"datePublished":"2014-07-21T00:31:07+00:00","dateModified":"2014-07-21T00:31:07+00:00","author":{"@id":"https:\/\/tylerfindlay.com\/#\/schema\/person\/53a67884f40536baaa37a6e37e404273"},"breadcrumb":{"@id":"https:\/\/tylerfindlay.com\/index.php\/2014\/07\/20\/are-guids-actually-unique\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/tylerfindlay.com\/index.php\/2014\/07\/20\/are-guids-actually-unique\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/tylerfindlay.com\/index.php\/2014\/07\/20\/are-guids-actually-unique\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/tylerfindlay.com\/"},{"@type":"ListItem","position":2,"name":"Are GUIDs actually unique?"}]},{"@type":"WebSite","@id":"https:\/\/tylerfindlay.com\/#website","url":"https:\/\/tylerfindlay.com\/","name":"Tyler Findlay","description":"Computer Scientist. Perpetual Vagabond. Technology whore. Leadership enthusiast. Liker of funny stuff. Would make an outstanding Jedi.","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/tylerfindlay.com\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/tylerfindlay.com\/#\/schema\/person\/53a67884f40536baaa37a6e37e404273","name":"admin","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/tylerfindlay.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/e964dc4307e6f3c229ac696c302fd293754245cc427c34e375eab35ec671b5d6?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/e964dc4307e6f3c229ac696c302fd293754245cc427c34e375eab35ec671b5d6?s=96&d=mm&r=g","caption":"admin"},"sameAs":["https:\/\/temp.tylerfindlay.com"],"url":"https:\/\/tylerfindlay.com\/index.php\/author\/tyler_d1ogunpg\/"}]}},"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/tylerfindlay.com\/index.php\/wp-json\/wp\/v2\/posts\/343","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/tylerfindlay.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tylerfindlay.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tylerfindlay.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/tylerfindlay.com\/index.php\/wp-json\/wp\/v2\/comments?post=343"}],"version-history":[{"count":0,"href":"https:\/\/tylerfindlay.com\/index.php\/wp-json\/wp\/v2\/posts\/343\/revisions"}],"wp:attachment":[{"href":"https:\/\/tylerfindlay.com\/index.php\/wp-json\/wp\/v2\/media?parent=343"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tylerfindlay.com\/index.php\/wp-json\/wp\/v2\/categories?post=343"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tylerfindlay.com\/index.php\/wp-json\/wp\/v2\/tags?post=343"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}