Svendsen Tech's New-RandomData function generates cryptographically secure or pseudorandom data. Can be used to generate keys and passwords with the -StreamToSTDOUT parameter, and has comprehensive features for generating files with random data, of a specified size.
On the Linux platform (and presumably macOS, untested), the sizes when you create files are off by -1 byte per line in the file. This can quite easily be fixed with some if statements against the variables $IsLinux and ... the one for macOS, and tweaking the code. Didn't revisit the code yet, so I don't have a clear picture of the amount of work required at the time of writing this.
Workaround: Add +1 * <number_of_lines> bytes to the total size when on Linux (or Mac).