What is the origin of the phrase "a shot in the dark"?

And can anyone confirm the punning meaning of that phrase in the Peter Sellers movie so titled?