I am searching for way to create a somewhat random string of 64k size.
But I want this to be fast as well. I have tried the following ways:
a) read from /dev/random — This is too slow
b) call rand() or a similar function of my own — a soln with few(<10) calls should be ok.
c) malloc() — On my Linux, the memory region is all zeroes always,
instead of some random data.
d) Get some randomness from stack variable addresses/ timestamp etc. to init initial few bytes.
Followed by copying over these values to the remaining array in different variations.
Would like to know if there is a better way to approach this.
/dev/randomblocks after its pool of random data has been emptied until it gathered new random data. You should try/dev/urandominstead.