Random file of set length

Randy Kaelber plug-discuss@lists.plug.phoenix.az.us
Wed, 11 Sep 2002 15:48:36 -0700


Matt Alexander wrote:
> 
> On Wed, 11 Sep 2002, Gilbert T. Gutierrez, Jr. wrote:
> 
> > I want to create a random file of 5MB.  How do I do that?
> 
> dd if=/dev/zero of=somefile bs=1024k count=5

Depending on one definition of random ("I need a J. Random 5 meg file")
that works, However, another definition ("I need a file with 5 megs of
random data") this suggests a slightly different approach:

If new need some fairly random data but you need it now:
dd if=/dev/urandom of=somefile bs=1024k count=5

Or I need some REALLY good random data I'm going to use as one time pads
to encode missile launch codes with, but I don't care if it takes a
while to generate:

dd if=/dev/random of=somefile bs=1024k count=5


-- 
Randy Kaelber                                       
Randy.Kaelber@asu.edu
Software Engineer  
Mars Space Flight Facility, Department of Geological Sciences
Arizona State University, Tempe, Arizona, USA

"Anarchy is the sure consequence of tyranny; for no power that is not
limited by laws can ever be protected by them." - Milton