On Tue, Jun 22, 2010 at 5:58 AM, David Boxenhorn <da...@lookin2.com> wrote: > I want to use UUIDs whose alphanumeric order is the same as their > chronological order. So I'm generating Version 4 UUIDs ( ... > Is there anything wrong with this idea?
If you want to keep it completely ordered, it's probably not enough to rely on System.currentTimeMillis(). It seems likely that it would sometimes be called twice for same clock value? This is easy to solve locally (just use an additional counter, that's what UUID packages do to get to 100 nanosecond resolution); and it might not matter in concurrent case (intra-node ordering is arbitrary but close enough). The other theoretical problem is reduction in random value space, but 75 bits of randomness may be well is enough. -+ Tatu +-