How do I generate $100$ numbers in $[0,1]$ which are more dense at $0$ and $1$? I just need to generate random numbers in $[0,1]$ which are more dense at the end points. I first thought of generating two sets of numbers from $N(0,1)$ and $N(1,1)$, and then using those. But that isn't working that well. Is there a better way?
Any command in SAGE will be most helpful! Thank you in advance!
 A: Five simple contenders:
1. Arc-Sine(0,1) distribution
Draw your pseudo-random samples from an Arc-Sine(0,1) distribution, with pdf:
$$ f(x) = \frac{1}{\pi \sqrt{1-x} \sqrt{x}}$$
which is nested by a $Beta(\frac12,\frac12)$ distribution. Here is a plot of the pdf:


2. Semi-circle (up)
$$f(x) = 2 - \frac{8 \sqrt{(1-x)x}}{\pi}$$


3. U-quadratic
$$f(x) = 3(1-2x)^2$$


4. V distribution
$$f(x) = 4 \omega  \left|x-\frac12\right|  + 1-\omega$$
where $0\le \omega \le 1$


5. sine of a Normal rv
Let $X$~$N(0,1)$. Then 
$$\frac{sin(X)+1}{2}$$
has your desired U-shape.
Unlike the other contenders, this one does not have a convenient closed-form solution for the pdf, ... but it is incredibly easy to generate. Just generate some standard Normals, apply the sin function, add 1, and divide it all by 2. Here is what the resulting empirical pdf looks like:

A: Generate some random variables $U_n$ uniformly distributed on $(0,1)$, and consider 
$$X_n=3U_n^2-2U_n^3.$$
Then every $X_n$ is symetrically distributed with respect to the middle point $.5$ but $P[X_n\leqslant x]\gt x$ for every $x$ in $(0,.5)$, for example $P[X_n\leqslant.1]=17.3\%$ instead of $10\%$, and $P[X_n\leqslant.2]=24.0\%$ instead of $10\%$.
To be able to tune the concentration of the distribution on the points $0$ and $1$, fix some parameter $\alpha\lt1$ and consider
$$
X_n=\tfrac12(1+\mathrm{sgn}(2U_n-1)\cdot|2U_n-1|^{\alpha}).
$$
Then the density of $X_n$ at $0$ and at $1$ is equivalent to $\alpha^{-1}$. If $\alpha=1$ this is the uniform distribution on $(0,1)$. If $\alpha\to0$, this is the uniform Bernoulli distribution on $\{0,1\}$.
A: You can sample points drawn from an arbitrary probability density $f$ by inverting its cumulative distribution function $F$ and applying it to a sample uniform in $[0,1]$.
For example, take $f(x)=(x-\frac 1 2)^2$, and you get $F(x)=\frac{\int_0^x f(t)dt}{\int_0^1 f(t)dt}=4x^3-6x^2+3x$. Then repeatedly solve $F(x)=y$, where $y$ are uniformly distributed in $[0,1]$ to get $f$-distributed points $x$. For that you can use any numerical solver (or polynomial in this case), I'm sure SAGE has one.
