My colleague and I are debating which of these methods to use for auto generating user ID\'s and post ID\'s for identification in the database:
One option uses a single
Use System.Guid as it:
...can be used across all computers and networks wherever a unique identifier is required.
Note that Random
is a pseudo-random number generator. It is not truly random, nor unique. It has only 32-bits of value to work with, compared to the 128-bit GUID.
However, even GUIDs can have collisions (although the chances are really slim), so you should use the database's own features to give you a unique identifier (e.g. the autoincrement ID column). Also, you cannot easily turn a GUID into a 4 or 20 (alpha)numeric number.