00001 00006 // Written by Curtis Olson, started July 1997. 00007 // 00008 // Copyright (C) 1997 Curtis L. Olson - http://www.flightgear.org/~curt 00009 // 00010 // This library is free software; you can redistribute it and/or 00011 // modify it under the terms of the GNU Library General Public 00012 // License as published by the Free Software Foundation; either 00013 // version 2 of the License, or (at your option) any later version. 00014 // 00015 // This library is distributed in the hope that it will be useful, 00016 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00018 // Library General Public License for more details. 00019 // 00020 // You should have received a copy of the GNU General Public License 00021 // along with this program; if not, write to the Free Software 00022 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00023 // 00024 // $Id: sg__random_8h_source.html,v 1.3 2010/02/23 22:10:16 curt Exp $ 00025 00026 00027 #ifndef _SG_RANDOM_H 00028 #define _SG_RANDOM_H 00029 00030 00031 #ifdef __cplusplus 00032 extern "C" { 00033 #endif 00034 00035 00036 #define MT_N 624 00037 #define MT_M 397 00038 00043 struct {unsigned int array[MT_N]; int index; } typedef mt; 00044 00048 void mt_init(mt *mt, unsigned int seed); 00049 00053 unsigned int mt_rand32( mt *mt); 00054 00059 double mt_rand(mt *mt); 00060 00065 void sg_srandom_time(); 00066 00072 void sg_srandom_time_10(); 00073 00079 void sg_srandom(unsigned int seed ); 00080 00085 double sg_random(); 00086 00087 00088 #ifdef __cplusplus 00089 } 00090 #endif 00091 00092 00093 #endif // _SG_RANDOM_H 00094 00095