News for hackers. Stuff that matters.
Re:Universally Unique Lexicographically Sortable Identifier ... by pritambarhate on Tuesday December 06, 2016 @12:58PM (#13116712)
Will the ulid be unique even if it is generated from 2 different machines at the same millisecond?
Re:Universally Unique Lexicographically Sortable Identifier ... by drfuchs on Tuesday December 06, 2016 @01:09PM (#13116822)
Yes, if your source of entropy is worth its salt.
Re:Universally Unique Lexicographically Sortable Identifier ... by vlowther on Tuesday December 06, 2016 @02:28PM (#13117519)
That was bad and you should feel bad. :)
Re:Universally Unique Lexicographically Sortable Identifier ... by tsenart on Tuesday December 06, 2016 @01:01PM (#13116746)
Yes if you use a good source of entropy. In Go, the easiest and most secure is the `crypto/rand.Reader`. But it's also slow. If you don't need the security properties, an instance of `math/rand.Rand` should suffice. Otherwise, you can implement your own. It's just an io.Reader!
Re:Universally Unique Lexicographically Sortable Identifier ... by Freak_NL on Tuesday December 06, 2016 @03:57PM (#13118274)
Doesn't that mean that it will usually — but not guaranteed always — be unique? That is, won't there always be a (minute and negligible depending on the intended use) chance of collision?
Re:Universally Unique Lexicographically Sortable Identifier ... by tsenart on Tuesday December 06, 2016 @05:17PM (#13118789)
Yes, there's always a negligible chance of collision.