Reg ruby 1.8 compatibility

I have replaced Random.rand with rand for ruby 1.8 compatibility