FastJet 3.0.5
BasicRandom.cc
00001 //STARTHEADER
00002 // simple random number generator class taken from nlojet++.
00003 // $Id: BasicRandom.cc 2471 2011-07-26 09:54:37Z cacciari $
00004 //
00005 //  Copyright (C) 2002 Zoltan Nagy
00006 //
00007 //  This program is free software; you can redistribute it and/or modify
00008 //  it under the terms of the GNU General Public License as published by
00009 //  the Free Software Foundation; either version 2 of the License, or
00010 //  (at your option) any later version.
00011 //
00012 //  This program is distributed in the hope that it will be useful,
00013 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
00014 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015 //  GNU General Public License for more details.
00016 //
00017 //  You should have received a copy of the GNU General Public License
00018 //  along with this program; if not, write to the Free Software
00019 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00020 //ENDHEADER
00021 
00022 //   nlo includes
00023 #include "fastjet/internal/BasicRandom.hh"
00024 
00025 
00026 FASTJET_BEGIN_NAMESPACE      // defined in fastjet/internal/base.hh
00027 
00028 
00029 //
00030 //                   random number generator
00031 //  uses method of L'Ecuyer, (via F.James, comp. phys. comm. 60(1990)329)
00032 //
00033 int __default_random_generator(int *__iseed) 
00034 {
00035   int __k = __iseed[0]/53668;
00036   __iseed[0] = (__iseed[0] - __k*53668)*40014 - __k*12211;
00037   if(__iseed[0] < 0) __iseed[0] += 2147483563;
00038   
00039   __k = __iseed[1]/52774;
00040   __iseed[1] = (__iseed[1] - __k*52774)*40692 - __k*3791;
00041   if(__iseed[1] < 0) __iseed[1] += 2147483399;
00042   
00043   int __iz = __iseed[0] - __iseed[1];
00044   if(__iz < 1) __iz += 2147483562;
00045   
00046   return __iz;
00047 }
00048 
00049 //   global defined random number generator
00050 BasicRandom<int>     _G_random_int;
00051 BasicRandom<double>  _G_random_double;
00052 
00053 
00054 FASTJET_END_NAMESPACE
00055 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends