\section{include/stdlib.h File Reference}
\label{stdlib_8h}\index{include/stdlib.h@{include/stdlib.h}}
Interface: reduced standard C library. 

{\tt \#include $<$mem.h$>$}\par
\subsection*{Functions}
\begin{CompactItemize}
\item 
void $\ast$ {\bf calloc} ({\bf size\_\-t} nmemb, {\bf size\_\-t} size)
\begin{CompactList}\small\item\em allocate and return pointer to initialized memory \item\end{CompactList}\item 
void $\ast$ {\bf malloc} ({\bf size\_\-t} size)
\begin{CompactList}\small\item\em allocate and return pointer to uninitialized memory \item\end{CompactList}\item 
void {\bf free} (void $\ast$ptr)
\begin{CompactList}\small\item\em return the allocated memory to memory management. \item\end{CompactList}\item 
long int {\bf random} (void)
\begin{CompactList}\small\item\em generate a random number \item\end{CompactList}\item 
void {\bf srandom} (unsigned int seed)
\begin{CompactList}\small\item\em seed the random number generator \item\end{CompactList}\end{CompactItemize}


\subsection{Detailed Description}
Interface: reduced standard C library. 

This file describes the public programming interface for memory management services and random number services \begin{Desc}
\item[Author:]Markus L. Noga $<${\tt markus@noga.de}$>$\end{Desc}


Definition in file {\bf stdlib.h}.

\subsection{Function Documentation}
\index{stdlib.h@{stdlib.h}!calloc@{calloc}}
\index{calloc@{calloc}!stdlib.h@{stdlib.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void$\ast$ calloc ({\bf size\_\-t} {\em nmemb}, {\bf size\_\-t} {\em size})}\label{stdlib_8h_a0}


allocate and return pointer to initialized memory 

{\bf calloc()}{\rm (p.\,\pageref{stdlib_8h_a0})} allocates memory for an array of \{nmemb\} elements of \{size\} bytes each and returns a pointer to the allocated memory. The memory is filled with zero values. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em nmemb}]the number of members to allocate \item[{\em size}]the size (in bytes) of each member to be allocated \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]a pointer to the allocated memory (or NULL if failed)\end{Desc}
NOTE: content of the returned memory is initialized by this routine 

Referenced by image\_\-load().\index{stdlib.h@{stdlib.h}!free@{free}}
\index{free@{free}!stdlib.h@{stdlib.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void free (void $\ast$ {\em ptr})}\label{stdlib_8h_a2}


return the allocated memory to memory management. 

{\bf free()}{\rm (p.\,\pageref{stdlib_8h_a2})} frees the memory space pointed to by \{ptr\}, which must have been returned by a previous call to {\bf malloc()}{\rm (p.\,\pageref{stdlib_8h_a1})}, or {\bf calloc()}{\rm (p.\,\pageref{stdlib_8h_a0})}. Other- wise, or if free(ptr) has already been called before, undefined behaviour occurs. If ptr is NULL, no operation is performed. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em ptr}]a pointer to previously allocated memory \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]Nothing \end{Desc}


Referenced by \_\-\_\-builtin\_\-delete().\index{stdlib.h@{stdlib.h}!malloc@{malloc}}
\index{malloc@{malloc}!stdlib.h@{stdlib.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void$\ast$ malloc ({\bf size\_\-t} {\em size})}\label{stdlib_8h_a1}


allocate and return pointer to uninitialized memory 

{\bf malloc()}{\rm (p.\,\pageref{stdlib_8h_a1})} allocates \{size\} bytes of memory and returns a pointer to it. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em size}]the number of bytes of memory to be allocated \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]a pointer to the allocated memory (or NULL if failed)\end{Desc}
NOTE: content of the returned memory is not initialized by this routine 

Referenced by \_\-\_\-builtin\_\-new(), lx\_\-from\_\-images(), and lx\_\-read().\index{stdlib.h@{stdlib.h}!random@{random}}
\index{random@{random}!stdlib.h@{stdlib.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}long int random (void)}\label{stdlib_8h_a3}


generate a random number 

The {\bf random()}{\rm (p.\,\pageref{stdlib_8h_a3})} function returns successive pseudo-random numbers \begin{Desc}
\item[Returns:]a random number in the range from 0 to RAND\_\-MAX \end{Desc}


Definition at line 77 of file random.c.

References prandom\_\-t::entry, generator, PRANDOM\_\-SLOTS, randstep(), prandom\_\-t::select, and prandom\_\-t::state.\index{stdlib.h@{stdlib.h}!srandom@{srandom}}
\index{srandom@{srandom}!stdlib.h@{stdlib.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void srandom (unsigned int {\em seed})}\label{stdlib_8h_a4}


seed the random number generator 

The {\bf srandom()}{\rm (p.\,\pageref{stdlib_8h_a4})} function sets its argument as the seed for a new sequence of pseudo-random integers to be returned by {\bf random()}{\rm (p.\,\pageref{stdlib_8h_a3})}. These sequences are repeatable by calling {\bf srandom()}{\rm (p.\,\pageref{stdlib_8h_a4})} with the same seed value. If no seed value is provided, the {\bf random()}{\rm (p.\,\pageref{stdlib_8h_a3})} function is automatically seeded with a value of 1. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em seed}]\end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]Nothing \end{Desc}
