\doxysection{genrand.\+h}
\label{genrand_8h_source}\index{include/sphinxbase/genrand.h@{include/sphinxbase/genrand.h}}
\textbf{ Go to the documentation of this file.}
\begin{DoxyCode}{0}
\DoxyCodeLine{00001\ \textcolor{comment}{/*\ -\/*-\/\ c-\/basic-\/offset:\ 4;\ indent-\/tabs-\/mode:\ nil\ -\/*-\/\ */}}
\DoxyCodeLine{00002\ \textcolor{comment}{/*\ }}
\DoxyCodeLine{00003\ \textcolor{comment}{\ \ \ A\ C-\/program\ for\ MT19937,\ with\ initialization\ improved\ 2002/1/26.}}
\DoxyCodeLine{00004\ \textcolor{comment}{\ \ \ Coded\ by\ Takuji\ Nishimura\ and\ Makoto\ Matsumoto.}}
\DoxyCodeLine{00005\ \textcolor{comment}{}}
\DoxyCodeLine{00006\ \textcolor{comment}{\ \ \ Before\ using,\ initialize\ the\ state\ by\ using\ init\_genrand(seed)\ \ }}
\DoxyCodeLine{00007\ \textcolor{comment}{\ \ \ or\ init\_by\_array(init\_key,\ key\_length).}}
\DoxyCodeLine{00008\ \textcolor{comment}{}}
\DoxyCodeLine{00009\ \textcolor{comment}{\ \ \ Copyright\ (C)\ 1997\ -\/\ 2002,\ Makoto\ Matsumoto\ and\ Takuji\ Nishimura,}}
\DoxyCodeLine{00010\ \textcolor{comment}{\ \ \ All\ rights\ reserved.\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ }}
\DoxyCodeLine{00011\ \textcolor{comment}{}}
\DoxyCodeLine{00012\ \textcolor{comment}{\ \ \ Redistribution\ and\ use\ in\ source\ and\ binary\ forms,\ with\ or\ without}}
\DoxyCodeLine{00013\ \textcolor{comment}{\ \ \ modification,\ are\ permitted\ provided\ that\ the\ following\ conditions}}
\DoxyCodeLine{00014\ \textcolor{comment}{\ \ \ are\ met:}}
\DoxyCodeLine{00015\ \textcolor{comment}{}}
\DoxyCodeLine{00016\ \textcolor{comment}{\ \ \ \ \ 1.\ Redistributions\ of\ source\ code\ must\ retain\ the\ above\ copyright}}
\DoxyCodeLine{00017\ \textcolor{comment}{\ \ \ \ \ \ \ \ notice,\ this\ list\ of\ conditions\ and\ the\ following\ disclaimer.}}
\DoxyCodeLine{00018\ \textcolor{comment}{}}
\DoxyCodeLine{00019\ \textcolor{comment}{\ \ \ \ \ 2.\ Redistributions\ in\ binary\ form\ must\ reproduce\ the\ above\ copyright}}
\DoxyCodeLine{00020\ \textcolor{comment}{\`{}\ \ \ \ \ \ \ \ notice,\ this\ list\ of\ conditions\ and\ the\ following\ disclaimer\ in\ the}}
\DoxyCodeLine{00021\ \textcolor{comment}{\ \ \ \ \ \ \ \ documentation\ and/or\ other\ materials\ provided\ with\ the\ distribution.}}
\DoxyCodeLine{00022\ \textcolor{comment}{}}
\DoxyCodeLine{00023\ \textcolor{comment}{\ \ \ \ \ 3.\ The\ names\ of\ its\ contributors\ may\ not\ be\ used\ to\ endorse\ or\ promote\ }}
\DoxyCodeLine{00024\ \textcolor{comment}{\ \ \ \ \ \ \ \ products\ derived\ from\ this\ software\ without\ specific\ prior\ written\ }}
\DoxyCodeLine{00025\ \textcolor{comment}{\ \ \ \ \ \ \ \ permission.}}
\DoxyCodeLine{00026\ \textcolor{comment}{}}
\DoxyCodeLine{00027\ \textcolor{comment}{\ \ \ THIS\ SOFTWARE\ IS\ PROVIDED\ BY\ THE\ COPYRIGHT\ HOLDERS\ AND\ CONTRIBUTORS}}
\DoxyCodeLine{00028\ \textcolor{comment}{\ \ \ "{}AS\ IS"{}\ AND\ ANY\ EXPRESS\ OR\ IMPLIED\ WARRANTIES,\ INCLUDING,\ BUT\ NOT}}
\DoxyCodeLine{00029\ \textcolor{comment}{\ \ \ LIMITED\ TO,\ THE\ IMPLIED\ WARRANTIES\ OF\ MERCHANTABILITY\ AND\ FITNESS\ FOR}}
\DoxyCodeLine{00030\ \textcolor{comment}{\ \ \ A\ PARTICULAR\ PURPOSE\ ARE\ DISCLAIMED.\ \ IN\ NO\ EVENT\ SHALL\ THE\ COPYRIGHT\ OWNER\ OR}}
\DoxyCodeLine{00031\ \textcolor{comment}{\ \ \ CONTRIBUTORS\ BE\ LIABLE\ FOR\ ANY\ DIRECT,\ INDIRECT,\ INCIDENTAL,\ SPECIAL,}}
\DoxyCodeLine{00032\ \textcolor{comment}{\ \ \ EXEMPLARY,\ OR\ CONSEQUENTIAL\ DAMAGES\ (INCLUDING,\ BUT\ NOT\ LIMITED\ TO,}}
\DoxyCodeLine{00033\ \textcolor{comment}{\ \ \ PROCUREMENT\ OF\ SUBSTITUTE\ GOODS\ OR\ SERVICES;\ LOSS\ OF\ USE,\ DATA,\ OR}}
\DoxyCodeLine{00034\ \textcolor{comment}{\ \ \ PROFITS;\ OR\ BUSINESS\ INTERRUPTION)\ HOWEVER\ CAUSED\ AND\ ON\ ANY\ THEORY\ OF}}
\DoxyCodeLine{00035\ \textcolor{comment}{\ \ \ LIABILITY,\ WHETHER\ IN\ CONTRACT,\ STRICT\ LIABILITY,\ OR\ TORT\ (INCLUDING}}
\DoxyCodeLine{00036\ \textcolor{comment}{\ \ \ NEGLIGENCE\ OR\ OTHERWISE)\ ARISING\ IN\ ANY\ WAY\ OUT\ OF\ THE\ USE\ OF\ THIS}}
\DoxyCodeLine{00037\ \textcolor{comment}{\ \ \ SOFTWARE,\ EVEN\ IF\ ADVISED\ OF\ THE\ POSSIBILITY\ OF\ SUCH\ DAMAGE.}}
\DoxyCodeLine{00038\ \textcolor{comment}{}}
\DoxyCodeLine{00039\ \textcolor{comment}{}}
\DoxyCodeLine{00040\ \textcolor{comment}{\ \ \ Any\ feedback\ is\ very\ welcome.}}
\DoxyCodeLine{00041\ \textcolor{comment}{\ \ \ http://www.math.keio.ac.jp/matumoto/emt.html}}
\DoxyCodeLine{00042\ \textcolor{comment}{\ \ \ email:\ matumoto@math.keio.ac.jp}}
\DoxyCodeLine{00043\ \textcolor{comment}{*/}}
\DoxyCodeLine{00044\ }
\DoxyCodeLine{00045\ \textcolor{comment}{/*\ ====================================================================}}
\DoxyCodeLine{00046\ \textcolor{comment}{\ *\ Copyright\ (c)\ 1999-\/2004\ Carnegie\ Mellon\ University.\ \ All\ rights}}
\DoxyCodeLine{00047\ \textcolor{comment}{\ *\ reserved.}}
\DoxyCodeLine{00048\ \textcolor{comment}{\ *}}
\DoxyCodeLine{00049\ \textcolor{comment}{\ *\ Redistribution\ and\ use\ in\ source\ and\ binary\ forms,\ with\ or\ without}}
\DoxyCodeLine{00050\ \textcolor{comment}{\ *\ modification,\ are\ permitted\ provided\ that\ the\ following\ conditions}}
\DoxyCodeLine{00051\ \textcolor{comment}{\ *\ are\ met:}}
\DoxyCodeLine{00052\ \textcolor{comment}{\ *}}
\DoxyCodeLine{00053\ \textcolor{comment}{\ *\ 1.\ Redistributions\ of\ source\ code\ must\ retain\ the\ above\ copyright}}
\DoxyCodeLine{00054\ \textcolor{comment}{\ *\ \ \ \ notice,\ this\ list\ of\ conditions\ and\ the\ following\ disclaimer.\ }}
\DoxyCodeLine{00055\ \textcolor{comment}{\ *}}
\DoxyCodeLine{00056\ \textcolor{comment}{\ *\ 2.\ Redistributions\ in\ binary\ form\ must\ reproduce\ the\ above\ copyright}}
\DoxyCodeLine{00057\ \textcolor{comment}{\ *\ \ \ \ notice,\ this\ list\ of\ conditions\ and\ the\ following\ disclaimer\ in}}
\DoxyCodeLine{00058\ \textcolor{comment}{\ *\ \ \ \ the\ documentation\ and/or\ other\ materials\ provided\ with\ the}}
\DoxyCodeLine{00059\ \textcolor{comment}{\ *\ \ \ \ distribution.}}
\DoxyCodeLine{00060\ \textcolor{comment}{\ *}}
\DoxyCodeLine{00061\ \textcolor{comment}{\ *\ This\ work\ was\ supported\ in\ part\ by\ funding\ from\ the\ Defense\ Advanced\ }}
\DoxyCodeLine{00062\ \textcolor{comment}{\ *\ Research\ Projects\ Agency\ and\ the\ National\ Science\ Foundation\ of\ the\ }}
\DoxyCodeLine{00063\ \textcolor{comment}{\ *\ United\ States\ of\ America,\ and\ the\ CMU\ Sphinx\ Speech\ Consortium.}}
\DoxyCodeLine{00064\ \textcolor{comment}{\ *}}
\DoxyCodeLine{00065\ \textcolor{comment}{\ *\ THIS\ SOFTWARE\ IS\ PROVIDED\ BY\ CARNEGIE\ MELLON\ UNIVERSITY\ \`{}\`{}AS\ IS''\ AND\ }}
\DoxyCodeLine{00066\ \textcolor{comment}{\ *\ ANY\ EXPRESSED\ OR\ IMPLIED\ WARRANTIES,\ INCLUDING,\ BUT\ NOT\ LIMITED\ TO,\ }}
\DoxyCodeLine{00067\ \textcolor{comment}{\ *\ THE\ IMPLIED\ WARRANTIES\ OF\ MERCHANTABILITY\ AND\ FITNESS\ FOR\ A\ PARTICULAR}}
\DoxyCodeLine{00068\ \textcolor{comment}{\ *\ PURPOSE\ ARE\ DISCLAIMED.\ \ IN\ NO\ EVENT\ SHALL\ CARNEGIE\ MELLON\ UNIVERSITY}}
\DoxyCodeLine{00069\ \textcolor{comment}{\ *\ NOR\ ITS\ EMPLOYEES\ BE\ LIABLE\ FOR\ ANY\ DIRECT,\ INDIRECT,\ INCIDENTAL,}}
\DoxyCodeLine{00070\ \textcolor{comment}{\ *\ SPECIAL,\ EXEMPLARY,\ OR\ CONSEQUENTIAL\ DAMAGES\ (INCLUDING,\ BUT\ NOT\ }}
\DoxyCodeLine{00071\ \textcolor{comment}{\ *\ LIMITED\ TO,\ PROCUREMENT\ OF\ SUBSTITUTE\ GOODS\ OR\ SERVICES;\ LOSS\ OF\ USE,\ }}
\DoxyCodeLine{00072\ \textcolor{comment}{\ *\ DATA,\ OR\ PROFITS;\ OR\ BUSINESS\ INTERRUPTION)\ HOWEVER\ CAUSED\ AND\ ON\ ANY\ }}
\DoxyCodeLine{00073\ \textcolor{comment}{\ *\ THEORY\ OF\ LIABILITY,\ WHETHER\ IN\ CONTRACT,\ STRICT\ LIABILITY,\ OR\ TORT\ }}
\DoxyCodeLine{00074\ \textcolor{comment}{\ *\ (INCLUDING\ NEGLIGENCE\ OR\ OTHERWISE)\ ARISING\ IN\ ANY\ WAY\ OUT\ OF\ THE\ USE\ }}
\DoxyCodeLine{00075\ \textcolor{comment}{\ *\ OF\ THIS\ SOFTWARE,\ EVEN\ IF\ ADVISED\ OF\ THE\ POSSIBILITY\ OF\ SUCH\ DAMAGE.}}
\DoxyCodeLine{00076\ \textcolor{comment}{\ *}}
\DoxyCodeLine{00077\ \textcolor{comment}{\ *\ ====================================================================}}
\DoxyCodeLine{00078\ \textcolor{comment}{\ *}}
\DoxyCodeLine{00079\ \textcolor{comment}{\ */}}
\DoxyCodeLine{00080\ }
\DoxyCodeLine{00081\ \textcolor{comment}{/*}}
\DoxyCodeLine{00082\ \textcolor{comment}{\ *\ randgen.c\ \ \ :\ a\ portable\ random\ generator\ }}
\DoxyCodeLine{00083\ \textcolor{comment}{\ *\ }}
\DoxyCodeLine{00084\ \textcolor{comment}{\ *}}
\DoxyCodeLine{00085\ \textcolor{comment}{\ *\ **********************************************}}
\DoxyCodeLine{00086\ \textcolor{comment}{\ *\ CMU\ ARPA\ Speech\ Project}}
\DoxyCodeLine{00087\ \textcolor{comment}{\ *}}
\DoxyCodeLine{00088\ \textcolor{comment}{\ *\ Copyright\ (c)\ 1999\ Carnegie\ Mellon\ University.}}
\DoxyCodeLine{00089\ \textcolor{comment}{\ *\ ALL\ RIGHTS\ RESERVED.}}
\DoxyCodeLine{00090\ \textcolor{comment}{\ *\ **********************************************}}
\DoxyCodeLine{00091\ \textcolor{comment}{\ *\ }}
\DoxyCodeLine{00092\ \textcolor{comment}{\ *\ HISTORY}}
\DoxyCodeLine{00093\ \textcolor{comment}{\ *\ \$Log:\ genrand.h,v\ \$}}
\DoxyCodeLine{00094\ \textcolor{comment}{\ *\ Revision\ 1.3\ \ 2005/06/22\ 03:01:50\ \ arthchan2003}}
\DoxyCodeLine{00095\ \textcolor{comment}{\ *\ Added\ \ keyword}}
\DoxyCodeLine{00096\ \textcolor{comment}{\ *}}
\DoxyCodeLine{00097\ \textcolor{comment}{\ *\ Revision\ 1.3\ \ 2005/03/30\ 01:22:48\ \ archan}}
\DoxyCodeLine{00098\ \textcolor{comment}{\ *\ Fixed\ mistakes\ in\ last\ updates.\ Add}}
\DoxyCodeLine{00099\ \textcolor{comment}{\ *}}
\DoxyCodeLine{00100\ \textcolor{comment}{\ *\ }}
\DoxyCodeLine{00101\ \textcolor{comment}{\ *\ 18-\/Nov-\/04\ ARCHAN\ (archan@cs.cmu.edu)\ at\ Carnegie\ Mellon\ University}}
\DoxyCodeLine{00102\ \textcolor{comment}{\ *\ \ \ \ \ \ \ \ \ \ \ \ \ \ First\ incorporated\ from\ the\ Mersenne\ Twister\ Random}}
\DoxyCodeLine{00103\ \textcolor{comment}{\ *\ \ \ \ \ \ \ \ \ \ \ \ \ \ Number\ Generator\ package.\ It\ was\ chosen\ because\ it\ is}}
\DoxyCodeLine{00104\ \textcolor{comment}{\ *\ \ \ \ \ \ \ \ \ \ \ \ \ \ in\ BSD-\/license\ and\ its\ performance\ is\ quite}}
\DoxyCodeLine{00105\ \textcolor{comment}{\ *\ \ \ \ \ \ \ \ \ \ \ \ \ \ reasonable.\ Of\ course\ if\ you\ look\ at\ the\ inventors's}}
\DoxyCodeLine{00106\ \textcolor{comment}{\ *\ \ \ \ \ \ \ \ \ \ \ \ \ \ page.\ \ This\ random\ generator\ can\ actually\ gives}}
\DoxyCodeLine{00107\ \textcolor{comment}{\ *\ \ \ \ \ \ \ \ \ \ \ \ \ \ 19937-\/bits\ period.\ \ This\ is\ already\ far\ from\ we\ need.\ }}
\DoxyCodeLine{00108\ \textcolor{comment}{\ *\ \ \ \ \ \ \ \ \ \ \ \ \ \ This\ will\ possibly\ good\ enough\ for\ the\ next\ 10\ years.\ }}
\DoxyCodeLine{00109\ \textcolor{comment}{\ *}}
\DoxyCodeLine{00110\ \textcolor{comment}{\ *\ \ \ \ \ \ \ \ \ \ \ \ \ \ I\ also\ downgrade\ the\ code\ a\ little\ bit\ to\ avoid\ Sphinx's}}
\DoxyCodeLine{00111\ \textcolor{comment}{\ *\ \ \ \ \ \ \ \ \ \ \ \ \ \ developers\ misused\ it.\ }}
\DoxyCodeLine{00112\ \textcolor{comment}{\ */}}
\DoxyCodeLine{00113\ }
\DoxyCodeLine{00114\ \textcolor{preprocessor}{\#ifndef\ \_LIBUTIL\_GENRAND\_H\_}}
\DoxyCodeLine{00115\ \textcolor{preprocessor}{\#define\ \_LIBUTIL\_GENRAND\_H\_}}
\DoxyCodeLine{00116\ }
\DoxyCodeLine{00117\ \textcolor{preprocessor}{\#define\ S3\_RAND\_MAX\_INT32\ 0x7fffffff}}
\DoxyCodeLine{00118\ \textcolor{preprocessor}{\#include\ <stdio.h>}}
\DoxyCodeLine{00119\ }
\DoxyCodeLine{00120\ \textcolor{comment}{/*\ Win32/WinCE\ DLL\ gunk\ */}}
\DoxyCodeLine{00121\ \textcolor{preprocessor}{\#include\ <sphinxbase/sphinxbase\_export.h>}}
\DoxyCodeLine{00122\ }
\DoxyCodeLine{00132\ \textcolor{preprocessor}{\#ifdef\ \_\_cplusplus}}
\DoxyCodeLine{00133\ \textcolor{keyword}{extern}\ \textcolor{stringliteral}{"{}C"{}}\ \{}
\DoxyCodeLine{00134\ \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{00135\ \textcolor{preprocessor}{\#if\ 0}}
\DoxyCodeLine{00136\ \textcolor{comment}{/*\ Fool\ Emacs.\ */}}
\DoxyCodeLine{00137\ \}}
\DoxyCodeLine{00138\ \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{00139\ }
\DoxyCodeLine{00144\ \textcolor{preprocessor}{\#define\ s3\_rand\_seed(s)\ genrand\_seed(s);}}
\DoxyCodeLine{00145\ \textcolor{preprocessor}{\#define\ s3\_rand\_int31()\ \ genrand\_int31()}}
\DoxyCodeLine{00146\ \textcolor{preprocessor}{\#define\ s3\_rand\_real()\ genrand\_real3()}}
\DoxyCodeLine{00147\ \textcolor{preprocessor}{\#define\ s3\_rand\_res53()\ \ genrand\_res53()}}
\DoxyCodeLine{00148\ }
\DoxyCodeLine{00152\ SPHINXBASE\_EXPORT}
\DoxyCodeLine{00153\ \textcolor{keywordtype}{void}\ genrand\_seed(\textcolor{keywordtype}{unsigned}\ \textcolor{keywordtype}{long}\ s);}
\DoxyCodeLine{00154\ }
\DoxyCodeLine{00158\ SPHINXBASE\_EXPORT}
\DoxyCodeLine{00159\ \textcolor{keywordtype}{long}\ genrand\_int31(\textcolor{keywordtype}{void});}
\DoxyCodeLine{00160\ }
\DoxyCodeLine{00164\ SPHINXBASE\_EXPORT}
\DoxyCodeLine{00165\ \textcolor{keywordtype}{double}\ genrand\_real3(\textcolor{keywordtype}{void});}
\DoxyCodeLine{00166\ }
\DoxyCodeLine{00170\ SPHINXBASE\_EXPORT}
\DoxyCodeLine{00171\ \textcolor{keywordtype}{double}\ genrand\_res53(\textcolor{keywordtype}{void});}
\DoxyCodeLine{00172\ }
\DoxyCodeLine{00173\ \textcolor{preprocessor}{\#ifdef\ \_\_cplusplus}}
\DoxyCodeLine{00174\ \}}
\DoxyCodeLine{00175\ \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{00176\ }
\DoxyCodeLine{00177\ \textcolor{preprocessor}{\#endif\ }\textcolor{comment}{/*\_LIBUTIL\_GENRAND\_H\_*/}\textcolor{preprocessor}{}}
\DoxyCodeLine{00178\ }
\DoxyCodeLine{00179\ }
\DoxyCodeLine{00180\ }

\end{DoxyCode}
