If you know the probabilities you want each number to have you could use discretize. For instance if I want to generate numbers between 1 and 10 with the odd numbers being twice as likely:
cumulativeP = [0 cumsum(P)./sum(P)]
d = discretize(r, cumulativeP);
h = histogram(d, (1:11)-0.5, 'Normalization', 'probability');
The bars for 1, 3, 5, 7, and 9 are about twice as tall as the bins for 2, 4, 6, 8, and 10 as expected.
shouldBeCloseToP = h.Values./h.Values(end)