All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Theodore Ts'o" <tytso@mit.edu>
To: David Lang <dlang@digitalinsight.com>
Cc: Bernard Normier <bernard@zeroc.com>, linux-kernel@vger.kernel.org
Subject: Re: Concurrent access to /dev/urandom
Date: Thu, 9 Dec 2004 01:36:54 -0500	[thread overview]
Message-ID: <20041209063654.GA9324@thunk.org> (raw)
In-Reply-To: <Pine.LNX.4.60.0412081905140.17193@dlang.diginsite.com>

On Wed, Dec 08, 2004 at 07:10:16PM -0800, David Lang wrote:
> 
> pulling data from /dev/random or /dev/urandom will not ensure that you 
> don't have duplicates.
> 
> remember the birthday paradox. it says that if you get a group of 26 
> people in a room you have about a 50% chance that two of these people have 
> the same birthday.
> 
> now that's only with numbers in the range of 1-365 if you pull 16 bit 
> numbers (1-65536) you will need a much larger group to see the problem, 
> but if you pull enough you WILL see the problem eventually.

Yes, but a UUID is 128 bits.  So the chance of a collision is 1 in
2**62.  (There are 4 version/type bits, so there are 122 bits of
randomness in a type-4, randomly generated UUID).  Assuming a
correctly working random number generator, yes, it's possible that you
could get a duplicate.  It's also possible that all of the oxygen
molecules could suddenly randomly end up in the other part of the
room, and you would suffocate.  But it's not very likely.  2**62 is a
rather large number....

						- Ted

  parent reply	other threads:[~2004-12-09  6:37 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-11-27 20:45 Concurrent access to /dev/urandom Bernard Normier
2004-11-27 20:56 ` Jan Engelhardt
2004-11-27 21:15   ` Bernard Normier
2004-11-27 21:22     ` Jan Engelhardt
2004-11-28 20:58       ` Bernard Normier
2004-12-07 23:41         ` Bernard Normier
2004-12-08  1:28           ` Theodore Ts'o
2004-12-08  1:56             ` Bernard Normier
2004-12-08 19:21               ` Theodore Ts'o
2004-12-08 20:15                 ` Bernard Normier
2004-12-08 21:56                 ` Matt Mackall
2004-12-09  1:57                   ` Theodore Ts'o
2004-12-09  2:46                     ` andyliu
2004-12-09  4:55                       ` Matt Mackall
2004-12-09  2:58                     ` Matt Mackall
2004-12-09 21:29                     ` Matt Mackall
2004-12-10  4:47                       ` Matt Mackall
2004-12-10 16:35                         ` Theodore Ts'o
2004-12-10 18:28                           ` Matt Mackall
2004-12-10 21:28                             ` Theodore Ts'o
2004-12-10 22:23                               ` Matt Mackall
2004-12-11  0:22                                 ` Adam Heath
2004-12-11  1:10                                   ` Matt Mackall
2004-12-11 17:33                                   ` Theodore Ts'o
2004-12-11 19:58                                     ` Adam Heath
2004-12-11 20:40                                       ` Matt Mackall
2004-12-12 16:19                                     ` Pavel Machek
2004-12-11  0:19                               ` Adam Heath
2004-12-09  3:10               ` David Lang
2004-12-09  4:52                 ` Matt Mackall
2004-12-09  6:36                 ` Theodore Ts'o [this message]
2004-11-29 22:47 ` Jon Masters
2004-11-29 23:14   ` Bernard Normier
2004-11-29 23:43     ` Sven-Haegar Koch
2004-11-30  2:31       ` David Schwartz
2004-11-30  4:14         ` Kyle Moffett
2004-11-30  8:23           ` Jan Engelhardt
2004-11-30 18:50             ` David Schwartz
2004-11-29 23:42   ` David Wagner

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=20041209063654.GA9324@thunk.org \
    --to=tytso@mit.edu \
    --cc=bernard@zeroc.com \
    --cc=dlang@digitalinsight.com \
    --cc=linux-kernel@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.