Example 1:
Sum of two uniform random variables: *X*=*U*_{1}+*U*_{2}.

Matlab:

res.sum2=sum(rand(2,100000)); hist(res.sum2); hist(res.sum2,100);

Here is what the output looked like for one of my simulations:

Notice the form of the histogram. It is very close to a triangle.

%And for 10 uniforms: res.sum10=sum(rand(10,100000)); hist(res.sum10); hist(res.sum10,100); %Is for commentsHere is what the output looked like for one of my simulations: