Random class is not supported by Ruby1.8.x, so now use rand (from Kernel) instead