8

I am looking for an application that will create a file of an arbitrary size, filled with pseudo-random data.

Must be able to create files at least 1GB in size (larger is better).

The application must work within , but can have a or be a command line tool .

The data need not be truly random, just pseudo-random.

The software must be .

I prefer and software, but neither is a requirement.

Note: Windows 7 SP1 is the lowest version of Windows that needs to be supported.

3
  • You could then use integrated wsh to script this but rdfc is probably easier (unless you have Python installed)
    – Marged
    Dec 25, 2015 at 11:58
  • Note that speed is an important aspect to take into consideration for this kind of tool. I haven't tested the solution with Python, but I quickly put together a basic PowerShell script and performances were terrible even for a 1 MB file. RDFC and dd are very fast.
    – mguassa
    Feb 2, 2016 at 21:48
  • 1
    mguassa, PowerShell is fast if you use something like suggested here: stackoverflow.com/questions/49835860/…
    – tolache
    Jan 31, 2019 at 13:55

7 Answers 7

4

You can use Random Data file Creator (RDFC).

Random Data File Creator, briefly RDFC, is a console application for Microsoft Windows, which can be used to create binary files of any size filled with random numbers. So, for example developers can create very large files (i.e. 1 TB) in order to test, how their own application deals with it.

Here's a test I've just run on Windows 10 in order to create a 100 MB file:

rdfc file.bin 100 MB

RDFC test

The application is freeware and portable (it doesn't require installation).

2
  • 1
    Does the job at 10 MB/s, basically unusable. Feb 17, 2018 at 13:28
  • I can confirm what Vlastimil Ovčáčík says: RDFC is slow. In my case 3.70MB/sec when creating a 100 MB file. Tested with Microsoft Windows 10. May 20, 2018 at 0:36
4

You can use Dummy File Creator:

  • Free for educational and non-commerical personal use
  • Portable
  • Microsoft Windows (requires Microsoft .NET Framework 3.5)
  • GUI and CLI

enter image description here

enter image description here

  • option to generate file with random content. True random in v1.1 but not in v1.2:

Dummy File Creator 1.2 writes random bytes ranging from 0 to 255. However, unlike previous version which generates true random file content, Dummy File Creator 1.2 uses a different approach in random content generation in order to increase the performance of random content generation. Dummy File Creator now will generate 4MB of random data and reuse the same data by altering only some bytes at random locations for each subsequent write. While the result still defeats all of the compression software we tested (i.e. a larger compressed file than the original size), but it is still possible to compress this pseudo-random content if a specifically designed compression algorithm targeted at Dummy File Creator (very unlikely) is used. To design such algorithm, it must use dictionary words with length ranging from 1 to 4,194,303 bytes. Most people will not notice this change, but for people who are developing compressing algorithms, it is recommended to use the previous version which generates true random contents (but much slower) for testing.

1
  • The best tool i have ever seen , like it's tremendously fast !
    – GOXR3PLUS
    Apr 12, 2019 at 8:55
2

dd for Windows is portable and open source.

It's the Windows version of the popular dd utility for Unix.

Here's an example about the creation of a 100 MB file:

dd bs=100M count=1 if=/dev/random of=C:\tmp\file.dat --progress

dd demo

I've used version 0.5 on Windows 10.

1

Python is free, gratis & open source, and cross platform and can be used as a script or interactivly - depending on the sort of random contents you need is would be as simple as:

from random import randint

desired_size = 1024*1024*1024 # 1 GByte
with open('RandomData.dat', 'wb') as outfile: # Open for binary output
    for x in xrange(desired_size):
       outfile.write(chr(randint(0,255))) # Write a random byte
print 'Done.'

You could of course expand the above to prompt for, or receive on the command line, the file name & desired size, to restrict the range or to output random text, etc.

2
  • I don't want to remember 6 lines of code for this. Feb 17, 2018 at 13:29
  • @VlastimilOvčáčík: You could always skip the done and put the desired size directly into the xrange which would cut it down to 4 lines if you memory is a problem - :-) Feb 18, 2018 at 6:10
1

In Python 3, to generate 25 files of 10GB each:

import os
desired_size = 1024*1024*1024*10 # 10 GBytes
desired_number_of_files = 25
for file_number in range(desired_number_of_files):
    filename = 'output_file{0:04d}.dat'.format(file_number)
    print('filename: {0}'.format(filename))
    with open(filename, 'wb') as fout: fout.write(os.urandom(desired_size))
print('Done.')

The line that generates the data (i.e. the line with urandom) is from Jon Clements on Creating random binary files. Also, in case you wonder: Whats the difference between os.urandom() and random?.

The speed on my computer (Microsoft Windows 10) is around 250 MB/second.

4
  • 2
    WARNING: To generate 10GB file this snippet will take 10GB of RAM since it buffers random string to memory first.
    – Zaar Hai
    Feb 20, 2020 at 5:14
  • @ZaarHai Thanks for the feedback, good point, I don't remember regarding the memory behavior. If that's an issue, maybe one could add some of the flushing ideas mentioned in How often does python flush to a file?. Feb 20, 2020 at 5:19
  • 1
    It's not about the flush. os.urandom(desired_size) first generates 10GiB long string, which takes RAM. Then you pass it to write(). You need to generate that big string in chunks.
    – Zaar Hai
    Feb 21, 2020 at 11:28
  • @ZaarHai thanks, got it, sorry I had read the code too quickly, I forgot the loop was for different files, I thought all iterations was to write in the same file Feb 21, 2020 at 17:59
1

cygwin.

It is effectively the common, command-line Unix/Linux tools, ported to Windows.

dd if=/dev/random of=file.img bs=1048576 count=10240

...or so, works also here, as like in @mguassa's excellent answer.

1
  • I've been meaning to take a close look at that project. Thank you Peter. Jul 29, 2020 at 0:29
0

Windows has a built-in command (works on fresh install without 3rd party software, but requires being run as administrator)

fsutil file createnew bigfile.out 10737418240

Option explanation: bigfile.out - the file that is being created (can include full path) 10737418240 - file size in bytes (here 10 GB)

2
  • 2
    The utility is good - but I would be surprised if it would create a file with random data. I think it creates a file full with zeros.
    – peterh
    Jul 28, 2020 at 20:18
  • Michal, would you mind testing the utility to see if peterh's assumption is true, and explain results in your answer? I don't have any Windows machine to try. Documentation about this would be even better. Thanks :-)
    – Nicolas Raoul
    Jul 28, 2020 at 23:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.