The operator of a random-speed production system is given T time units to produce D units of a product. The machine has M nominal production speeds (rates of production), though the actual production speed is confounded by random noises. The operator counts products at adjustment epochs and changes the production speed according to the amount accumulated and time left. He wants to minimize (maximize) the expected cost (profit) subject to the adjustment, operating, inventory, shortage cost, and over production costs. Such a problem has been tackled by various heuristic methods. We formulate the problem as a continuous-time, continuous-state dynamic program and solve it by the multi-grid discretization approach. Our approach is very versatile, solving problems more general than those solved in literature. The approach allows the selection of grid sizes based on the accuracy of the approximation. When compared to existing heuristics through simulation, our approach is quicker and has better objective values.