00001 // $Id: mmdb_math_rand.h $ 00002 // ================================================================= 00003 // 00004 // CCP4 Coordinate Library: support of coordinate-related 00005 // functionality in protein crystallography applications. 00006 // 00007 // Copyright (C) Eugene Krissinel 2000-2013. 00008 // 00009 // This library is free software: you can redistribute it and/or 00010 // modify it under the terms of the GNU Lesser General Public 00011 // License version 3, modified in accordance with the provisions 00012 // of the license to address the requirements of UK law. 00013 // 00014 // You should have received a copy of the modified GNU Lesser 00015 // General Public License along with this library. If not, copies 00016 // may be downloaded from http://www.ccp4.ac.uk/ccp4license.php 00017 // 00018 // This program is distributed in the hope that it will be useful, 00019 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00020 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00021 // GNU Lesser General Public License for more details. 00022 // 00023 // ================================================================= 00024 // 00025 // 12.09.13 <-- Date of Last Modification. 00026 // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 00027 // ----------------------------------------------------------------- 00028 // 00029 // **** Module : Rand <interface> 00030 // ~~~~~~~~~ 00031 // **** Classes : RandomNumber ( random number generator ) 00032 // ~~~~~~~~~ 00033 // 00034 // (C) E. Krissinel 1997-2013 00035 // 00036 // ================================================================= 00037 // 00038 00039 #ifndef __MMDB_MATH_Rand__ 00040 #define __MMDB_MATH_Rand__ 00041 00042 #include "mmdb_io_file.h" 00043 00044 namespace mmdb { 00045 00046 namespace math { 00047 00048 // ------------------------------------------------------------- 00049 00050 enum RN_MAX_SEED { 00051 _RN_MAX_IJ = 31328, 00052 _RN_MAX_KL = 30081 00053 }; 00054 00055 DefineClass(RandomNumber); 00056 00057 class RandomNumber { 00058 public : 00059 RandomNumber ( long IJ=0, long KL=0 ); 00060 void Init ( long IJ=0, long KL=0 ); 00061 realtype gauss_rnd(); 00062 realtype random (); 00063 realtype srandom (); 00064 00065 void read ( io::RFile f ); 00066 void write ( io::RFile f ); 00067 00068 protected : 00069 long I97,J97; 00070 realtype U[97],C,CD,CM; 00071 realtype gset; 00072 long iset; 00073 00074 }; 00075 00076 } // namespace math 00077 00078 } // namespace mmdb 00079 00080 #endif
1.7.2