I need to use simulation to show that sums of independent uniform random variables approach a Gaussian distribution. I want to write function of m, n, a, b , where m is number of simulations, n is size of simulation and a and b are parameters, which will give a sum as an output.

My code is:

fun=function(m,n,a,b){

x=rep(0,n)

sum=rep(0,n)

for (i in (1:m)){

x

*=runif(n,a,b)*

sum=sum+x

sum=sum+x

}

sum

}

I get warning message that

1: In x}

sum

}

I get warning message that

1: In x

*= runif(n, a, b) :*

number of items to replace is not a multiple of replacement length

which I cannot interpret.

Thanks for your time and help!number of items to replace is not a multiple of replacement length

which I cannot interpret.

Thanks for your time and help!