switching from rand() to OpenSSL::Random

@atmos everything looks really good. My only problem is that it is using `rand()` for the state generation. It would take a lot of other problems for this to be exploitable, but still we should be using OpenSSL for randomness.