Hi all, I have a quick question. I am trying to make a stochastic model within Matlab. Essentially I want to have a 100length array that with every time step, a random 50 of those indexes get something added to it. Here is what I have Code: close all clear all m_large = 10^-7; %grams m_small = 10^-8; %grams large_matrix = m_large*ones(100,1); small_matrix = m_small*ones(100,1); array = [1:1:100]; n_array = large_matrix; for timestep = 1:10 x = randperm(50); %gives 50 radom indexes without repeating index = x; for i = 1:100 for j = 1:length(x) n_array(x(j)) = large_matrix(x(j))+10^-8; end end end Right now, I am trying to get one timestep to work. The problem I am running into is that when I try to pull the index from x (say x(1) = 42, I then want the 42 index in n_array to be added to) seems not to work..ie it adds to the first 50 elements in n_array, so not random like I am trying to obtain. Any ideas? Thanks!