\hypertarget{group__surfrand}{
\section{surfrand: Random number generator based on SURF}
\label{group__surfrand}\index{surfrand: Random number generator based on SURF@{surfrand: Random number generator based on SURF}}
}
\subsection*{Data Structures}
\begin{CompactItemize}
\item 
struct \hyperlink{structsurfrand}{surfrand}
\end{CompactItemize}
\subsection*{Functions}
\begin{CompactItemize}
\item 
void \hyperlink{group__surfrand_g543f668d9157853de725e637ca8e31b7}{surfrand\_\-init} (struct \hyperlink{structsurfrand}{surfrand} $\ast$c, const uint32 $\ast$data, unsigned words)
\item 
uint32 \hyperlink{group__surfrand_g48d5b73169fc296c6e9665afa9bce0a2}{surfrand\_\-uint32} (struct \hyperlink{structsurfrand}{surfrand} $\ast$c)
\item 
double \hyperlink{group__surfrand_gf98246673277f05e14bb4fc80a9cf97a}{surfrand\_\-double} (struct \hyperlink{structsurfrand}{surfrand} $\ast$c)
\item 
void \hyperlink{group__surfrand_g860a0ec8878526164d13a8f21db204d3}{surfrand\_\-fill} (struct \hyperlink{structsurfrand}{surfrand} $\ast$c, unsigned char $\ast$buf, unsigned len)
\end{CompactItemize}


\subsection{Function Documentation}
\hypertarget{group__surfrand_gf98246673277f05e14bb4fc80a9cf97a}{
\index{surfrand@{surfrand}!surfrand\_\-double@{surfrand\_\-double}}
\index{surfrand\_\-double@{surfrand\_\-double}!surfrand@{surfrand}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}double surfrand\_\-double (struct {\bf surfrand} $\ast$ {\em c})}}
\label{group__surfrand_gf98246673277f05e14bb4fc80a9cf97a}


Output a random double precision floating-point number in the range 0-1.

This routine uses two calls to surfrand\_\-uint32 to fill all the precision of a double precision floating-point with randomness. \hypertarget{group__surfrand_g860a0ec8878526164d13a8f21db204d3}{
\index{surfrand@{surfrand}!surfrand\_\-fill@{surfrand\_\-fill}}
\index{surfrand\_\-fill@{surfrand\_\-fill}!surfrand@{surfrand}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void surfrand\_\-fill (struct {\bf surfrand} $\ast$ {\em c}, unsigned char $\ast$ {\em buf}, unsigned {\em len})}}
\label{group__surfrand_g860a0ec8878526164d13a8f21db204d3}


Fill the buffer with random data \hypertarget{group__surfrand_g543f668d9157853de725e637ca8e31b7}{
\index{surfrand@{surfrand}!surfrand\_\-init@{surfrand\_\-init}}
\index{surfrand\_\-init@{surfrand\_\-init}!surfrand@{surfrand}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void surfrand\_\-init (struct {\bf surfrand} $\ast$ {\em c}, const uint32 $\ast$ {\em data}, unsigned {\em words})}}
\label{group__surfrand_g543f668d9157853de725e637ca8e31b7}


Initialize the {\tt \hyperlink{structsurfrand}{surfrand}} structure.

Initializes the seed in {\tt c} from the input {\tt data}, and sets the counter to zero. If more than {\tt SURF\_\-SEED\_\-U32} bytes of input data is given, the extra data is merged into the seed. If less, the given data is repeated until the seed is filled.

The counter is treated as a giant multi-word integer, and is incremented once each time data is generated. This makes the theoretical period of this generator 8$\ast$2$^\wedge$32$^\wedge$12 or $>$10$^\wedge$116. \hypertarget{group__surfrand_g48d5b73169fc296c6e9665afa9bce0a2}{
\index{surfrand@{surfrand}!surfrand\_\-uint32@{surfrand\_\-uint32}}
\index{surfrand\_\-uint32@{surfrand\_\-uint32}!surfrand@{surfrand}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}uint32 surfrand\_\-uint32 (struct {\bf surfrand} $\ast$ {\em c})}}
\label{group__surfrand_g48d5b73169fc296c6e9665afa9bce0a2}


Output an random unsigned 32-bit integer.

All the bits in the output integer are equally random. 