How can I generate n random numbers from (a, b) interval such that these numbers are densely concentrated around min and max and getting progressively sparse in the middle.
$\begingroup$
$\endgroup$
2
-
$\begingroup$ Could you define more precisely what do you mean by "densely concentrated around min and max and getting progressively sparse in the middle"? It can understood differently by different people. I guess beta distribution with parameters <1 can work for you, but this needs clarification. $\endgroup$– TimCommented Mar 22, 2018 at 8:49
-
$\begingroup$ Welcome to Cross Validated. Some related questions have already been answered, e.g. stats.stackexchange.com/questions/324878/… try searching this site and if your question is more specific than the questions here please update which specific part you are asking about. $\endgroup$– Martin ModrákCommented Mar 22, 2018 at 8:50
Add a comment
|
1 Answer
$\begingroup$
$\endgroup$
0
Use a beta-distribution with both parameters equal and less than one. For instance:
shape1 <- 1/4
shape2 <- 1/4
set.seed(123)
hist(rbeta(1e4,shape1,shape2))
This will give you numbers between 0 and 1. Shift and scale these to match your desired $a$ and $b$.
The NIST Gallery of Distributions is often useful to find a distribution