MATLAB: I need to remove randi from for loop

for looprani

I need to remove randi from the for loop. Any help would appreciate.
I=30;
t1=randi([1 5],1,I);
t2=randi([6 10],1,I);
for i=1:I
TD(1,i)=randi([t1(1,i) t2(1,i)],1,1);
end

Best Answer

randi() takes a range of integers. Since you want that range to change every column, I don't see how there is a way to do it without a for loop. However, if the (badly-named) I is less than a million, the for loop will be fast (less than a second or so)
Related Question