function a = example1_parallel()

% adjust m and N according to your resources 
N = 2000; 
m = 50; 
a = zeros(N,1); 
seeds = (1:N);

matlabpool open local 2
tic; % serial (regular) for-loop 
parfor I = 1:N 
    a(I) = largestEigenvalue(m,seeds(I)); 
end
t = toc;
matlabpool close

disp(['Time for parallel calculation: ', num2str(t), ' seconds.'])
hist(a)