The replacement of a machine which deteriorates at a random rate is considered. We measure this deterioration in terms of a cost per unit time--i.e., a cost-density (t) where t is the age of the machine. Given the probability distribution of (t) and the replacement cost R(c, t) when (t) = c, we discuss optimal replacement using two different procedures: (1) replacement at a fixed age (2) replacement when the cost-density reaches a given value Expressions are derived for the resulting costs incurred in using either procedure over a long period of time. Method (2) is in general preferable.