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