Probabilistic Analysis of Programs: A Weak Limit Approach