How to speed up the following code inside a foreach %dopar%?
it is already embedded inside a paralleled foreach loop. Therefore, it better uses only one core. But Is there any way to reduce its computational time a little bit with single core? Thank you.
n = 1e5
k = 10
mu = 0
sigma = 1
x = matrix(data=NA, nrow=n, ncol=k)
for(j in 1:k) {
for(i in 1:n) {
x[i,j] = rnorm(1, mu, sigma)
}
}