  We describe a quantum algorithm to prepare an arbitrary pure state of a
register of a quantum computer with fidelity arbitrarily close to 1. Our
algorithm is based on Grover's quantum search algorithm. For sequences of
states with suitably bounded amplitudes, the algorithm requires resources that
are polynomial in the number of qubits. Such sequences of states occur
naturally in the problem of encoding a classical probability distribution in a
quantum register.
