implemented Java's math.random