So, I am looking for a way to speed up my code. I have a large vector of normal distributions (i.e. a vector of means and standard deviations) that I need to generate random
Hacked into normrnd.m
to get this customized code that must replicate the functionality depicited in the problem -
N=1e6;
mu = rand(N,1);
sigma = rand(N,1);
temp = randn(size(sigma)).*sigma + mu;
On my system, the runtime was reduced from 18.946094 seconds
to 0.037229 seconds
.
Hope this works out for you!