Damn, that is _my_ usual answer :-) My gut feeling is to shell to the OS existing UID generation.
::CreateUuid() in Windows for example. Not idea what it is on other OS. On Sat, Oct 4, 2008 at 3:39 AM, Chris Anderson <[EMAIL PROTECTED]> wrote: > patches welcome! > > On Fri, Oct 3, 2008 at 5:30 PM, Ayende Rahien <[EMAIL PROTECTED]> wrote: > > The problem is with the guarantees that the method does. > > This is a valid implementation for random number generator: > > http://xkcd.com/221/ > > > > A UUID isn't going to be duplicated, because it is unique to the machine > and > > time it was generated, and there is care taken to ensure that even if you > > have two thread creating the a guid on the same micro second, you'll get > two > > different guids. > > There is no such guarantees for random numbers. > > > > On Sat, Oct 4, 2008 at 3:06 AM, Paul Davis <[EMAIL PROTECTED] > >wrote: > > > >> Ayende, > >> > >> Perhaps I'm missing something, but I don't see the problem. > >> > >> I suppose you could technically claim that we're not setting the > >> version bits properly but that seems rather not important given that > >> we have the revision protection. Also unless I'm mistaken this would > >> only be a problem if someone is using an external UUID generation > >> scheme that happens to be extremely not random. Which while possible, > >> would still send up red flags on constant collisions on document > >> creation. > >> > >> Paul > >> > >> On Fri, Oct 3, 2008 at 7:49 PM, Ayende Rahien <[EMAIL PROTECTED]> > wrote: > >> > Looking at the method implementation, it looks like there might be a > >> problem > >> > here. > >> > > >> > new_uuid() -> > >> > list_to_binary(to_hex(crypto:rand_bytes(16))). > >> > > >> > In particular, we aren't actually guaranteed to have a unique value. > >> > You can read more about what needs to be done to get unique guids: > here: > >> > http://blogs.msdn.com/oldnewthing/archive/2008/06/27/8659071.aspx > >> > > >> > > > > > > -- > Chris Anderson > http://jchris.mfdz.com >
