linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andi Kleen <andi@firstfloor.org>
To: Andreas Dilger <adilger@clusterfs.com>
Cc: Andi Kleen <andi@firstfloor.org>,
	Kalpak Shah <kalpak@clusterfs.com>,
	linux-ext4 <linux-ext4@vger.kernel.org>,
	TheodoreTso <tytso@mit.edu>
Subject: Re: Random corruption test for e2fsck
Date: Thu, 12 Jul 2007 13:09:23 +0200	[thread overview]
Message-ID: <20070712110923.GA500@one.firstfloor.org> (raw)
In-Reply-To: <20070712051938.GD5586@schatzie.adilger.int>

On Wed, Jul 11, 2007 at 11:19:38PM -0600, Andreas Dilger wrote:
> On Jul 11, 2007  17:20 +0200, Andi Kleen wrote:
> > If you use a normal pseudo random number generator and print the seed
> > (e.g. create from the time) initially the image can be easily recreated 
> > later without shipping it around. /dev/urandom
> > is not really needed for this since you don't need cryptographic
> > strength randomness. Besides urandom data is precious and it's 
> > a pity to use it up needlessly.
> > 
> > bash has $RANDOM built in for this purpose.
> 
> Except it is a lot more efficient and easy to do

Ah you chose to only address one sentence in my reply.
I thought only Linus liked to to do that.

If you're worried about efficiency it's trivial to
write a C program that generates bulk pseudo random numbers using
random(3) 

> "dd if=/dev/urandom bs=1k ..." than to spin in a loop getting 16-bit
> random numbers from bash.  We would also be at the mercy of the shell
> being identical on the user and debugger's systems.

With /dev/urandom you have the guarantee you'll never ever reproduce
it again. 

Andrea A. used to rant about people who use srand(time(NULL)) 
in benchmarks and it's sad these mistakes get repeated again and again.

-Andi

  reply	other threads:[~2007-07-12 11:09 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-10 13:07 Random corruption test for e2fsck Kalpak Shah
2007-07-10 14:58 ` Theodore Tso
2007-07-10 15:42   ` Eric Sandeen
2007-07-11  7:03   ` Kalpak Shah
     [not found]   ` <20070711094410.GM6417@schatzie.adilger.int>
2007-07-11 17:43     ` Theodore Tso
2007-07-12  5:15       ` Andreas Dilger
2007-07-12  5:52   ` Andreas Dilger
2007-07-10 15:47 ` Eric Sandeen
2007-07-11 16:03   ` Andreas Dilger
2007-07-11 15:20 ` Andi Kleen
2007-07-12  5:19   ` Andreas Dilger
2007-07-12 11:09     ` Andi Kleen [this message]
2007-07-12 22:16       ` Andreas Dilger
2007-07-12 22:24         ` Andi Kleen
2007-07-13  7:12           ` Kalpak Shah

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=20070712110923.GA500@one.firstfloor.org \
    --to=andi@firstfloor.org \
    --cc=adilger@clusterfs.com \
    --cc=kalpak@clusterfs.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=tytso@mit.edu \
    /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;
as well as URLs for NNTP newsgroup(s).