Add write_rand() method.

This method generates and sends over the connection a random char array, with the
lenght passed as a parameter. In this way, it is possibile to avoid uselessly
copying data.