00001 //-------------------------------------------------------------------------- 00002 // 00003 // Environment: 00004 // This software is part of the EvtGen package developed jointly 00005 // for the BaBar and CLEO collaborations. If you use all or part 00006 // of it, please give an appropriate acknowledgement. 00007 // 00008 // Copyright Information: See EvtGen/COPYRIGHT 00009 // Copyright (C) 1998 Caltech, UCSB 00010 // 00011 // Module: EvtRandomEngine.cc 00012 // 00013 // Description: routines to generate random numbers 00014 // really trivial random number 00015 // implementation. 00016 // 00017 // Modification history: 00018 // 00019 // RYD December 25, 1999 Module created 00020 // 00021 //------------------------------------------------------------------------ 00022 // 00023 #include "EvtGenBase/EvtPatches.hh" 00024 00025 00026 #include <stdio.h> 00027 #include <math.h> 00028 #include <iostream> 00029 #include "EvtGenBase/EvtRandomEngine.hh" 00030 00031 double EvtRandomEngine::random(){ 00032 00033 static unsigned long int next = 1; 00034 00035 next=next*1103515245+123345; 00036 unsigned temp=(unsigned)(next/65536) % 32768; 00037 00038 return ( temp + 1.0 ) / 32769.0; 00039 00040 } 00041 00042 00043