FastJet  3.1.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
BasicRandom.cc
1 //FJSTARTHEADER
2 // $Id: BasicRandom.cc 3433 2014-07-23 08:17:03Z salam $
3 //
4 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez
5 //
6 //----------------------------------------------------------------------
7 // This file is part of FastJet.
8 //
9 // FastJet is free software; you can redistribute it and/or modify
10 // it under the terms of the GNU General Public License as published by
11 // the Free Software Foundation; either version 2 of the License, or
12 // (at your option) any later version.
13 //
14 // The algorithms that underlie FastJet have required considerable
15 // development. They are described in the original FastJet paper,
16 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use
17 // FastJet as part of work towards a scientific publication, please
18 // quote the version you use and include a citation to the manual and
19 // optionally also to hep-ph/0512210.
20 //
21 // FastJet is distributed in the hope that it will be useful,
22 // but WITHOUT ANY WARRANTY; without even the implied warranty of
23 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 // GNU General Public License for more details.
25 //
26 // You should have received a copy of the GNU General Public License
27 // along with FastJet. If not, see <http://www.gnu.org/licenses/>.
28 //----------------------------------------------------------------------
29 //FJENDHEADER
30 
31 // nlo includes
32 #include "fastjet/internal/BasicRandom.hh"
33 
34 
35 FASTJET_BEGIN_NAMESPACE // defined in fastjet/internal/base.hh
36 
37 
38 //
39 // random number generator
40 // uses method of L'Ecuyer, (via F.James, comp. phys. comm. 60(1990)329)
41 //
42 int __default_random_generator(int *__iseed)
43 {
44  int __k = __iseed[0]/53668;
45  __iseed[0] = (__iseed[0] - __k*53668)*40014 - __k*12211;
46  if(__iseed[0] < 0) __iseed[0] += 2147483563;
47 
48  __k = __iseed[1]/52774;
49  __iseed[1] = (__iseed[1] - __k*52774)*40692 - __k*3791;
50  if(__iseed[1] < 0) __iseed[1] += 2147483399;
51 
52  int __iz = __iseed[0] - __iseed[1];
53  if(__iz < 1) __iz += 2147483562;
54 
55  return __iz;
56 }
57 
58 // global defined random number generator
59 BasicRandom<int> _G_random_int;
60 BasicRandom<double> _G_random_double;
61 
62 
63 FASTJET_END_NAMESPACE
64