Path: csiph.com!usenet.pasdenom.info!dedibox.gegeweb.org!gegeweb.eu!nntpfeed.proxad.net!proxad.net!feeder1-2.proxad.net!usenet-fr.net!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.119 X-Spam-Level: * X-Spam-Evidence: '*H*': 0.76; '*S*': 0.00; 'django': 0.10; ':-)': 0.13; '4-digit': 0.16; '65536': 0.16; 'definition.': 0.16; 'hex': 0.16; 'hits': 0.16; 'precise': 0.22; 'tables': 0.23; 'least': 0.25; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; "doesn't": 0.28; 'hash': 0.29; 'probability': 0.29; 'resolution': 0.30; 'problem.': 0.32; 'oracle': 0.33; 'turns': 0.33; 'to:addr :python-list': 0.33; "can't": 0.34; 'there': 0.35; 'characters': 0.36; 'should': 0.36; 'thank': 0.36; 'possible': 0.37; 'bad': 0.37; 'uses': 0.37; 'subject:: ': 0.38; 'mean': 0.38; 'to:addr:python.org': 0.39; 'received:192': 0.39; 'received:192.168': 0.40; 'your': 0.60; 'first': 0.61; 'side': 0.61; 'chance': 0.61; 'ever': 0.63; 'received:204': 0.72; '50%': 0.81; 'collision': 0.84; 'birthday': 0.91 Date: Fri, 27 Jul 2012 09:28:56 +0200 From: Laszlo Nagy User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:14.0) Gecko/20120714 Thunderbird/14.0 MIME-Version: 1.0 To: python-list@python.org Subject: Re: Generating valid identifiers References: <50116281$0$29978$c3e8da3$5496439d@news.astraweb.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 16 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1343374141 news.xs4all.nl 6942 [2001:888:2000:d::a6]:47258 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:26135 > As a side note, the odds of having at least one hash collision among > multiple tables are known as the birthday problem. At 4 hex digits > there are 65536 possible digests, and it turns out that at 302 tables > there is a >50% chance that at least one pair of those names have the > same 4-digit digest. That doesn't mean you should be concerned if you > have 302 tables in your Django Oracle database, though, because those > colliding tables also have to match completely in the first 26 > characters of their generated names, which is not that common. If a > collision ever did occur, the resolution would be simple: manually set > the name of one of the offending tables in the model definition. > > With 16 ** 10 possible digests, the probability of collision hits 50% > at 1234605 tables. Thank you for the precise explanation. :-) Well, if Django and Oracle uses this, then it can't be a very bad idea. :-)