Skip to content

Instantly share code, notes, and snippets.

@GeertVL-zz
Last active April 15, 2020 14:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save GeertVL-zz/a8530a42ab27fe0df6647585f20c7237 to your computer and use it in GitHub Desktop.
Save GeertVL-zz/a8530a42ab27fe0df6647585f20c7237 to your computer and use it in GitHub Desktop.
Create random file
private static void CreateRandomTempFile(string fileName, long lengthInMb)
{
// https://stackoverflow.com/questions/4432178/creating-a-random-file-in-c-sharp
byte[] data = new byte[lengthInMb * 1024 * 1024];
Random rng = new Random();
rng.NextBytes(data);
File.WriteAllBytes(fileName, data);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment