Coherence and randomness in quantum theory