Github user ahgittin commented on a diff in the pull request:

    https://github.com/apache/incubator-brooklyn/pull/61#discussion_r14807592
  
    --- Diff: utils/common/src/main/java/brooklyn/util/text/Identifiers.java ---
    @@ -51,6 +51,9 @@
          * in general this is preferable to base64 as is more portable,
          * can be used throughout javascript (as ID's which don't allow +)
          * or as java identifiers (which don't allow numbers in the first char)
    +     * 
    +     * WARNING: The method is not as random as advertised!
    +     *          Highly probable to return the same id in the first 2000 
attempts. 
    --- End diff --
    
    It is as random as *advertised*, but not as random as a caller might think 
it is, including me!
    
    I suggest saying "with length 4" it is "not unlikely (15% chance)" -- 
rather than "highly probable" -- that you'll get duplicates in the first 2000 
attempts.
    
    Probably worth noting "with length 8 there is a 1% chance of duplicates at 
2M and a 50% chance of duplicates at 16M", as we use length 8 when we really 
care about uniqueness.
    
    Even that is much sooner than I expected however.  We could use length 12 
(puts us in the range of 7B before a 1% chance of duplicates, by my calcs) -- 
though I tend to think a better option is a pluggable unique identifier source, 
which we've discussed and would be quite useful in any case, also allowing ID 
to indicate time order when that matters or origination (in a distributed 
context).  /cc @aledsage


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to