From: William Lee Irwin III <wli@holomorphy.com>
To: jlnance@unity.ncsu.edu
Cc: root@mauve.demon.co.uk, linux-kernel@vger.kernel.org
Subject: Re: Lockless file readingu
Date: Fri, 29 Aug 2003 08:43:39 -0700 [thread overview]
Message-ID: <20030829154339.GB1715@holomorphy.com> (raw)
In-Reply-To: <20030829100011.GA663@ncsu.edu>
On Fri, Aug 29, 2003 at 06:00:11AM -0400, jlnance@unity.ncsu.edu wrote:
> Be careful. I remember discussing in probability class the liklyhood that
> two people in a room with N people have the same birthday. N does not have
> to be anywhere close to 365 for your probability of a collision to be greater
> than 50%. I forget what the exact number is but its less than 30. The
> image problem sounds similar, depending on exactly how you phrase it.
This is very simple to see. Consider the probability of not having a
collision instead of having a collision. Each choice eliminates a
choice, so the probability of not colliding while taking a sample after
taking N samples from a uniform distribution over K values is (K-N)/K.
You end up getting 1 - K!/((K-N)! * K**N).
Given one possible value for each day of the year, K == 365.
So you want 1 - 365!/((365 - N)! * 365**N) > 1/2.
The first few probabilities of collision (calculated afresh) are:
0 0.0
1 0.0
2 2.739726027397249e-3
3 8.204165884781345e-3
4 1.6355912466550326e-2
5 2.713557369979358e-2
6 4.0462483649111536e-2
7 5.6235703095975365e-2
8 7.433529235166902e-2
9 9.462383388916673e-2
10 0.11694817771107757
11 0.14114137832173312
12 0.16702478883806438
13 0.19441027523242949
14 0.223102512004973
15 0.25290131976368646
16 0.2836040052528499
17 0.31500766529656066
18 0.34691141787178936
19 0.37911852603153673
20 0.41143838358058005
21 0.4436883351652058
22 0.4756953076625501
23 0.5072972343239854
24 0.5383442579145288
25 0.5686997039694639
26 0.598240820135939
27 0.626859282263242
28 0.6544614723423994
29 0.680968537477777
30 0.7063162427192686
31 0.7304546337286438
32 0.7533475278503207
33 0.774971854175772
34 0.7953168646201543
35 0.8143832388747152
36 0.8321821063798795
37 0.8487340082163846
38 0.8640678210821209
39 0.878219664366722
40 0.891231809817949
41 0.9031516114817354
42 0.9140304715618692
43 0.9239228556561199
44 0.9328853685514263
45 0.940975899465775
46 0.9482528433672547
47 0.9547744028332994
48 0.9605979728794224
49 0.9657796093226765
50 0.9703735795779884
N = 23 should do fine for your purposes.
-- wli
next prev parent reply other threads:[~2003-08-29 15:42 UTC|newest]
Thread overview: 56+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-08-27 12:37 Lockless file reading Timo Sirainen
2003-08-27 12:42 ` Martin Konold
2003-08-27 12:52 ` Timo Sirainen
2003-08-27 13:40 ` Richard B. Johnson
2003-08-27 14:56 ` Timo Sirainen
2003-08-27 23:39 ` Jamie Lokier
2003-08-28 0:52 ` Timo Sirainen
2003-08-27 18:42 ` Nagendra Singh Tomar
2003-08-28 8:40 ` Timo Sirainen
2003-08-27 21:15 ` Nagendra Singh Tomar
2003-08-28 9:35 ` Timo Sirainen
2003-08-27 21:52 ` Nagendra Singh Tomar
2003-08-28 13:26 ` Matthias Andree
2003-08-28 9:17 ` David Schwartz
2003-08-28 8:42 ` Valdis.Kletnieks
2003-08-28 20:13 ` David B. Stevens
2003-08-28 1:50 ` Jamie Lokier
2003-08-28 3:17 ` Timo Sirainen
2003-08-28 6:01 ` Valdis.Kletnieks
2003-08-28 6:13 ` Jamie Lokier
2003-08-28 8:57 ` Timo Sirainen
2003-08-28 9:56 ` David Schwartz
2003-08-28 10:26 ` Timo Sirainen
2003-08-27 22:58 ` Nagendra Singh Tomar
2003-08-28 12:18 ` Jamie Lokier
2003-08-28 0:39 ` Nagendra Singh Tomar
2003-08-28 13:00 ` Jamie Lokier
2003-08-28 1:06 ` Nagendra Singh Tomar
2003-08-28 21:49 ` Bernd Eckenfels
2003-08-28 12:01 ` Jamie Lokier
2003-08-28 13:28 ` Timo Sirainen
2003-08-28 20:24 ` David Schwartz
2003-08-28 12:44 ` Ragnar Hojland Espinosa
2003-08-28 13:03 ` Jamie Lokier
2003-08-28 17:26 ` root
2003-08-28 17:35 ` Jamie Lokier
2003-08-28 18:10 ` root
2003-08-28 21:59 ` Bernd Eckenfels
2003-08-28 23:02 ` Jamie Lokier
2003-08-28 23:44 ` Lockless file readingu root
2003-08-29 10:00 ` jlnance
2003-08-29 11:55 ` David Schwartz
2003-08-29 15:43 ` William Lee Irwin III [this message]
2003-08-28 20:37 ` Lockless file reading David Schwartz
2003-08-28 22:11 ` Bernd Eckenfels
2003-08-28 23:00 ` Jamie Lokier
2003-08-29 0:47 ` David Schwartz
2003-08-28 9:13 ` Martin Konold
2003-08-28 9:27 ` Timo Sirainen
2003-08-28 9:48 ` Martin Konold
2003-08-28 0:03 ` Jamie Lokier
2003-08-28 12:08 ` Richard B. Johnson
2003-08-28 12:39 ` Jamie Lokier
2003-08-28 10:08 ` Matthias Andree
2003-08-28 10:54 ` Robin Rosenberg
2003-08-28 12:42 ` Jamie Lokier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20030829154339.GB1715@holomorphy.com \
--to=wli@holomorphy.com \
--cc=jlnance@unity.ncsu.edu \
--cc=linux-kernel@vger.kernel.org \
--cc=root@mauve.demon.co.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox