You can draw numbers from a random sample with weighted probability by using
For example,
population = 1:20;
k = 10;
w = linspace(0,1,numel(population));
y = randsample(population,k,true,w)
Or you could draw random numbers from a normal distribution using X = randn(n). For example, this line below draws 20 random values from a normal distribution centered at 7 with standard deviation of 5.
Best Answer