It is legal if you're in good shape and therefore the risk of that happening is minimal. It is illegal to drive a car under an altered state that makes it more likely to happen. It is a balance between the benefits of permitting something and the likelihood of something bad happens. In normal conditions, the benefits are believed to outweigh the risks, so it is generally permitted to drive a car. But it is not permitted to drive it if you're under the effect of some substance that can alter your perception of reality.