Guid vs random string?

It depends on algorithm which you will use. If you have good generator the result would be the same The likelihood depends on how good both the generators are (yours vs. GUID one).

It depends on algorithm which you will use. If you have good generator the result would be the same. The likelihood depends on how good both the generators are (yours vs. GUID one).

GUID-generation algorithms take into account the date and time as well as generating random numbers to create the final 128 bit value. If you simply generate random strings w/o any other algorithmics thrown in then yes, you will run a much greater risk of collision. (Computers cannot create truly random numbers so other data has to folded into the GUID gen algorithms to lower risk of collision.

GUID v1 for example used a computer's MAC address though that approach has been deprecated since it identifies the generating computer. ) You could create your own GUID value but why reinvent something that already works well?

If your random number generator has a quality equal or superior to the GUID generator's quality, then your random string will always be better than a GUID, because not all the GUID's bits are random.

I would suggest to use actual guid's. The chances that your random string generator would be unique is far less than that of a guid.

Depending on the encoding, a char can be two bytes, so 32 chars can be 64 bytes. A Guid on the other is 16 bytes. If you have an equivalent amount of randomness in your generator, your string will produce less chance of collision.

Saying that, the chance of collision in 16 bytes is pretty unlikely as it is. The clinch is that you have to have at least as good a generator as the Guid generator to make it worthwhile. When you do that, patent it.

You should look at how guids are generated, this post blogs.msdn.com/oldnewthing/archive/2008/... explains one guid algorithm really well.

Social MSDN gives little info, but doesn't answer your question whether a collision is more likely or not. Guid Structure tells a GUID is not a string but "A GUID is a 128-bit integer (16 bytes) that can be used across all computers and networks wherever a unique identifier is required. Such an identifier has a very low probability of being duplicated.

Depends on the GUID you're comparing it against: nowadays most GUIDs are "Version 4", which is really just a big random number with some wasted bits. So as long as your random number generator is as good as the one used to generate the GUID, your solution is more unique. If it's a Version 1 GUID, then it's probably more unique than a random number (assuming it's being used as expected: the system clock isn't being reset very often, the system has a network card, and the MAC address hasn't been tampered with) but most people don't use version 1 anymore because it leaks your MAC address.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions