If I create a new NSData object of a specific size using dataWithBytes:length:, what is the most efficient way to create the input bytes (20 Mb worth) of random characters, preferably without reading the data in from a file? I need a unique buffer of a specific size each time.
Thanks
Swift 3:
You might consider using
CCRandomGenerateBytes
function fromCommonCrypto
to generate random data. Like:urandom is more efficient.
Here is a category to generate random buffers: