\hypertarget{rand_8c}{}\section{rand.\+c File Reference}
\label{rand_8c}\index{rand.\+c@{rand.\+c}}


Rand for Elektra.  


{\ttfamily \#include \char`\"{}kdbrand.\+h\char`\"{}}\newline
{\ttfamily \#include $<$kdbassert.\+h$>$}\newline
{\ttfamily \#include $<$time.\+h$>$}\newline
Include dependency graph for rand.\+c\+:
\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=313pt]{rand_8c__incl}
\end{center}
\end{figure}
\subsection*{Functions}
\begin{DoxyCompactItemize}
\item 
void \hyperlink{rand_8c_ae91ec71e40877ce45ad2584381dd9030}{elektra\+Rand} (int32\+\_\+t $\ast$seed)
\begin{DoxyCompactList}\small\item\em Non cryptographic pseudo random number generator. \end{DoxyCompactList}\item 
int32\+\_\+t \hyperlink{rand_8c_a7133a0aa999cdbe8f0c3cffb8c0d1d20}{elektra\+Rand\+Get\+Init\+Seed} (void)
\begin{DoxyCompactList}\small\item\em Random initial seed generator. \end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Detailed Description}
Rand for Elektra. 

\begin{DoxyCopyright}{Copyright}
B\+SD License (see L\+I\+C\+E\+N\+S\+E.\+md or \href{https://www.libelektra.org}{\tt https\+://www.\+libelektra.\+org}) 
\end{DoxyCopyright}


\subsection{Function Documentation}
\mbox{\Hypertarget{rand_8c_ae91ec71e40877ce45ad2584381dd9030}\label{rand_8c_ae91ec71e40877ce45ad2584381dd9030}} 
\index{rand.\+c@{rand.\+c}!elektra\+Rand@{elektra\+Rand}}
\index{elektra\+Rand@{elektra\+Rand}!rand.\+c@{rand.\+c}}
\subsubsection{\texorpdfstring{elektra\+Rand()}{elektraRand()}}
{\footnotesize\ttfamily void elektra\+Rand (\begin{DoxyParamCaption}\item[{int32\+\_\+t $\ast$}]{seed }\end{DoxyParamCaption})}



Non cryptographic pseudo random number generator. 

By Ray Gardner www8.\+cs.\+umu.\+se/$\sim$isak/snippets/rg\+\_\+rand.c

based on \char`\"{}\+Random Number Generators\+: Good Ones Are Hard to Find\char`\"{}, S.\+K. Park and K.\+W. Miller, Communications of the A\+CM 31\+:10 (Oct 1988), and \char`\"{}\+Two Fast Implementations of the \textquotesingle{}\+Minimal Standard\textquotesingle{} Random
\+Number Generator\char`\"{}, David G. Carta, Comm. A\+CM 33, 1 (Jan 1990), p. 87-\/88

linear congruential generator f(z) = 16807 z mod (2 $\ast$$\ast$ 31 -\/ 1)

uses L. Schrage\textquotesingle{}s method to avoid overflow problems

Make sure the initial seed is\+: 0 $<$ seed $<$ E\+L\+E\+K\+T\+R\+A\+R\+A\+N\+D\+M\+AX


\begin{DoxyParams}{Parameters}
{\em seed} & a pointer to the seed \\
\hline
\end{DoxyParams}
\mbox{\Hypertarget{rand_8c_a7133a0aa999cdbe8f0c3cffb8c0d1d20}\label{rand_8c_a7133a0aa999cdbe8f0c3cffb8c0d1d20}} 
\index{rand.\+c@{rand.\+c}!elektra\+Rand\+Get\+Init\+Seed@{elektra\+Rand\+Get\+Init\+Seed}}
\index{elektra\+Rand\+Get\+Init\+Seed@{elektra\+Rand\+Get\+Init\+Seed}!rand.\+c@{rand.\+c}}
\subsubsection{\texorpdfstring{elektra\+Rand\+Get\+Init\+Seed()}{elektraRandGetInitSeed()}}
{\footnotesize\ttfamily int32\+\_\+t elektra\+Rand\+Get\+Init\+Seed (\begin{DoxyParamCaption}\item[{void}]{ }\end{DoxyParamCaption})}



Random initial seed generator. 

Generates a random initial seed for the {\ttfamily elektra\+Rand (...)} function. Two invocations in the same second return the same random initial seed, due to the usage of {\ttfamily time (0)}.


\begin{DoxyRetVals}{Return values}
{\em random} & initial seed \\
\hline
\end{DoxyRetVals}
