Last active
April 15, 2020 14:04
-
-
Save GeertVL-zz/a8530a42ab27fe0df6647585f20c7237 to your computer and use it in GitHub Desktop.
Create random file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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