Updated patch to use another random function and to remove stdio calls.

The random function is based on AmiSSL.