-
Notifications
You must be signed in to change notification settings - Fork 0
/
homework2problem1parta.tex
executable file
·36 lines (26 loc) · 2 KB
/
homework2problem1parta.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
\subsection{Part A}
In this part we are tasked with creating a random number generator that, when given an integer seed as input, returns the same seed with its bits scrambled up (hopefully) beyond recognition. A list populated with outputs from a sufficiently effective random number generator will do two things: ensure minimal correlation between neighboring points in the list and distribute random numbers evenly across the entire domain (in this case, between 0 and 1).
The random number generator provided below achieves both goals, while an additional MWC had to be included in order to meet the second requirement. Figure \ref{fig:21a1} plots ordered pairs ($x_{i}$, $x_{i+1}$), where $i = 0, 1, \dots, 1000$. I included a rainbow color scheme such that points with small values of $i$ are purple and ones with high $i$ values are red. This becomes apparent in Figure \ref{fig:21a2} where the ordered pairs are $(i, x_{i})$. There are a few places where neighboring points cluster to a concerning degree (especially for small $i$ values); further investigation is needed.
In addition to binning 1 million pseudo-random numbers generated by the scheme in 20 bins 0.05 wide (see Figure \ref{fig:21a3}) I included horizontal lines indicating $\mu \pm m\sigma$, where $\mu$, $\sigma$ are the mean and standard deviation of the bin populations ($m = 1, 2$).
\lstinputlisting{homework2problem1parta.py}
\lstinputlisting{homework2problem1parta_print.txt}
\clearpage
\begin{figure}[h]
\centering
\includegraphics{homework2problem1partafigure1.pdf}
\caption{Scatter plot of first 1000 points.}
\label{fig:21a1}
\end{figure}
\begin{figure}[h]
\centering
\includegraphics{homework2problem1partafigure2.pdf}
\caption{Scatter plot of first 1000 numbers and their respective indices.}
\label{fig:21a2}
\end{figure}
\begin{figure}[h]
\centering
\includegraphics{homework2problem1partafigure3.pdf}
\caption{Histogram of pseudo-randomly generated numbers.}
\label{fig:21a3}
\end{figure}
\clearpage