# Uniform Distribution

$X∼Uniform(a,b)$ if

$P(X=x)=f(x)={b−a1 0 a≤x≤botherwise $

- $E(X)=2b+a $
- $Var(X)=121 (b−a)_{2}$.

This distribution may seem simple, but it has two important properties:

- Gateway to more complex Distribution
- You’ve seen this first-hand at Ericsson (more details below)

- Universality Property
- Suppose $X$ is a r.v. with CDF $F(X)$. If we are interested in generating $n$ simulations of $X$, i.e. we want to generate $n$ outcomes ${x_{1},x_{2},…,x_{n}}$, we can generate the following: ${F_{−1}(u_{1}),F_{−1}(u_{2}),…,F_{−1}(u_{n})}$, where $u_{1},u_{2},…,u_{n}∼Uniform(0,1)$

### Ericsson: Generating Random Uniform Distributions

This was a tough problem that I faced when working at Ericsson. The built-in rand() function in C seemed to be too slow. However, the faster version using seeds really wasn’t good enough when I tried to use it in Thompson Sampling.

Actually, it seems that they are trying to implement a version of the xorshift. https://en.wikipedia.org/wiki/Xorshift

Let’s look into some alternatives: