# Dan's Segment 11

1. For this we are going to cheat a little. The CDF is calculated by integrating the PDF, and rather than performing the integration myself I'm simply going to look it up. According to wikipedia, the CDF is:

$F(x,x_0,\sigma) = \frac{1}{\pi} \arctan\left(\frac{x-x_0}{\sigma}\right)+\frac{1}{2}$

To get the inverse CDF, we want to solve for x in terms of F.

$\tan(\pi*[F-.5])*\sigma+x_0 = x$

2. Without actually writing up the code, the idea is to select random values of F from 0 to 1 and then insert them into the inverse CDF to return the random deviate. In pseudo-code it looks something like this:

icdf(F) = $\tan(\pi*[F-.5])*\sigma+x_0$

f = rand(0,1)

x = icdf(f)

## Class Activity

Worked together with Rcardenas and Jin. For our exact code, see Jin's page. The idea was to take the fastest changing positions from the system clock and map those digits onto an un-ordered set of numbers. Unfortunately, we converged to certain patterns very quickly. Perhaps altering our set of numbers somehow after each draw would sufficiently randomize the process.