change call to rand for older versions of ruby, extends support to 1.8.7...

... as well