MATLAB: Just a small problem

thanks before!!!

Hi! Can you help me please with this problem: How can I Write a function that produces random integers From 1000 to 9999, and including the numbers of different 4-digit (with no repetition)? In MatLab…

Best Answer

function y=MyRandInt
while true
y=floor(8999*rand+1000);
if length(unique(num2str(y)))==4
return;
end
end