Random File Generator (again!)

delphi, random, test-data, windows

Solution

Use a 4096-byte page-size, or multiple page-size, buffer. Writing one integer at a time will be slow.

Problem

I badly need a random file generator that generates a truly random, non-compressible dummy files. I ended up with this delphi code. It works, but it's painfully sloooow ``` var Buf : Integer; TheFile : TFileStream; begin TheFile := TFileStream.Create(FileName, fmCreate OR fmOpenReadWrite); with TheFile do begin for i := 0 to FileSize do // Iterate begin Buf := Random(999999) * i; WriteBuffer(Buf, SizeOf(Buf)); end; // for end; // with end, ``` My question is: Is there a fast random file generator that I can use? Both Delphi code and/or commandline tools are acceptable as long as: - I can run it on Windows without manual intervention (I need this for my tests, no intervention is allowed) - It's fast - Files generated is non-compressible (ie. compressing the generated file results in no space saving) EDIT For those interested, I applied the advice I received here and made this function, it's fast enough & 7zip has hard time compressing the generated data.

Original source

Related problems