MATLAB: Generate random sequence number with condition

random number generator

Hello every one!
I'm a beginner in matlab. Please help me this.
For example, if I want to generate a sequence random numbers (This sequence includes 200numbers) of values from 0.1 to 3.5 provided that the amount of numbers greater than 2 is only 10% of the total. How to do this in matlab. Can someone help me out? Thank you in advance.

Best Answer

P=interp1([0 0.9 1],[0.1 2 3.5],'pchip','pp');
n = 1e6; % 200 in your case
% here is the array of random
r=ppval(P,rand(1,n));
% this should return value close to 0.1
sum(r>=2)/length(r)