Create a file of random bytes

Hi All,

I have the need to generate artificial files filled with random data. I don’t need crypto-level randomness, just the ability to quickly generate 4MB to 4GB worth of bytes per file.

I’ve created a couple of loops using Random, but it seems to take a very long time just to generate a few million bytes. On Linux or macOS, I would shell out and use something like:
dd if=/dev/urandom of=/sources/filename-4M.dat bs=4k count=512

Or similar. However, we don’t have that as an option for Windows, so I’m looking at options in Xojo that would work on all three Desktop platforms. MBS and Einhugur plugins are available and speed in generating a few hundred files is the major concern.



RandomBytesStringMBS function maybe?

Thanks but not really a help since I still have to generate the random content.

I knew I recalled something like that. Thanks.

did you try :

SQLite has a “randomblob” function. Should work on all platforms: randomblob(N)