• Main Page
  • Related Pages
  • Data Structures
  • Files
  • File List
  • Globals

include/genrand.h

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

Generated on Thu Jan 6 2011 for SphinxBase by  doxygen 1.7.1