1) I have predefined probabilities of picking random numbers which is p = [0.16 0.24 0.28 0.32] for the intervals [3.3 4.6], [4.6 5.9], [5.9,7.2], and [7.2 8.5].
To implement that, you will need to create a random number in the range [0 1] and find it within the boundaries of cumsum(p) in order to find out which interval it is. Then you would use independent distributions for each of the ranges, each with 100% total probability. This might require using a beta distribution for each of them in practice.
truncate() of a distribution is also a possibility: truncate automatically rescales the values so that the total probability within the truncated range is 100% -- a normal distribution truncated to a range will not look exactly like what would happen if you took a normal distribution and somehow values outside the truncation range just "don't count" and yet magically do not affect the probability calculations. A truncate()'d distribution is still a real distribution with a real pdf() and real cdf() that are meaningful.
2) I would like to pick more number of elements from higher end of intervals, for example numbers picked from [7.2 8.5] should be closer to 8.5 than to 7.2.
You have not really defined how you want to clusture more closely. one approach over the interval [a, b] is to use
(1-exp(-x))/int(1-exp(-x),a,b)
Another is to use
but although these work out mathematically, I suspect that over [7.2 8.5] that the shapes of them might not bias the results visibly enough for your purposes.
Best Answer