|
-
Nov 4th, 2003, 02:31 AM
#1
Thread Starter
Fanatic Member
GUIDS - Quick question.
This is from the top of my head so its not 100% correct 
A microsoft GUID is simply a compound of numbers and letters that depend on the systems hardware, time, and various types of variables.
Format:
{xxxxxx-xxxx-xxxx-xxxxxx}
X can be anything from 1 - 0 or A to Y?
its something like that anyway...
Sooo... what im asking is:
instead of using a GUID, couldent i simply make a random value for every X and it would be just as good as a MS Guid?
Last edited by invitro; Nov 4th, 2003 at 02:36 AM.
ok, so... windows takes 1 minute to search for a file on my PC yet google.com takes 1 second to search the entire internet? 
-
Nov 4th, 2003, 04:02 AM
#2
In theory it's an ID that is unique to that instance of the program in the world; a radom value is not going to achieve that
-
Nov 4th, 2003, 04:16 AM
#3
Fanatic Member
ok
Guid like this:
{"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"}
that GUID is 32 digits long....
each 'digit' is a hex digit (0->9, A->E)
=> 2^4 values per digit, 32 digits
=> 2^(4*32) = 2^128 different GUIDs
(i.e. GUID is a 128-bit data structure)
Thats a number about 39 digits long!!!
Random integer (32-bit) = 2^32 different IDS
thats 10 digits, and now you have so many fewer options
Even with 64-bit integers, thats 2^64 different IDs, but u've still got 2^64 times fewer! which means only have a tiny percentage of what you can have with a GUID
however, if u used 4 random integers, or any struct/type with more than 128 bits, then this is just as good if not better. However, 128-bit was considered enough, and so to save space they just kept it at that.
sql_lall 
-
Nov 4th, 2003, 11:19 AM
#4
However, it seems to me that a GUID may be slightly superior to the random numbers. Since the GUID is supposed to be unique by definition, it isn't random. If you look at date and time:
mm/dd/yyyy hh:mm:ss.ss
You have only 16 characters that are only in the range 0-9, yet no two dates in history have ever been the same at this scale.
If you were to use random numbers (four four-byte random longintegers, or something like that), you would have a probability of having the same number twice, though the probability would be vanishingly small if the random number generator were truly random. Since random number generators are not truly random, it seems like the probability of two numbers the same is somewhat greater than 1 in 2^128th.
-
Nov 5th, 2003, 07:18 PM
#5
Thread Starter
Fanatic Member
ok i see what you mean... now this is just for arguments sake 
Since a guid has a finite number of possibilities, wouldent that mean that eventualy a value would repeat itself? Or if the values were truly unique, then a GUID would stop working in the distant future since the possibilities would run out?
ok, so... windows takes 1 minute to search for a file on my PC yet google.com takes 1 second to search the entire internet? 
-
Nov 5th, 2003, 07:40 PM
#6
I'm sure Microsoft has a way of generating unique GUID's, so I doubt they would ever repeat until all of them are used up. Theoretically, that could happen, although it would most likely take longer to use them all than for the computer they're on to decompose
The time you enjoy wasting is not wasted time.
Bertrand Russell
<- Remember to rate posts you find helpful.
-
Nov 6th, 2003, 04:43 AM
#7
Fanatic Member
all about timing
2^128 GUIDs.
Lets assume 1 created EVERY SECOND! *yes, thats never going to happen, but just run with this, as a COMPLETELY Worst-case.
1 per 1 second
2^128 takes 2^128 seconds
1000 years = 31536000000 second
2^35 = 34359738368
=> 1000 years = approx 2^35
=> it would take 2^128/2^35 = 2^93 millenia...
change that to 2^10 = 1024 per second, and thats still 2^83 millenia
To get them all used up within 100 years, you would need to make 10 * 2^93 PER SECOND!
Sure, you don't have to use every single one before you get a clash, but even, to get anywhere near 1% prob. you would take ages...
Hey and who knows, if ppl start getting worried, why not make it 256-bit, and all old GUIDs just start with 128-bits of 0 will now take 2^128 times as long again...
sql_lall 
-
Nov 6th, 2003, 02:50 PM
#8
Thread Starter
Fanatic Member
ahhh thanks all I have been enlightened!
ok, so... windows takes 1 minute to search for a file on my PC yet google.com takes 1 second to search the entire internet? 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|