[11] | 1 | // simple random number generator class taken from nlojet++.
|
---|
| 2 | // $Id: BasicRandom.cc,v 1.1 2008-11-06 14:32:13 ovyn Exp $
|
---|
| 3 |
|
---|
| 4 | // Copyright (C) 2002 Zoltan Nagy
|
---|
| 5 | //
|
---|
| 6 | // This program is free software; you can redistribute it and/or modify
|
---|
| 7 | // it under the terms of the GNU General Public License as published by
|
---|
| 8 | // the Free Software Foundation; either version 2 of the License, or
|
---|
| 9 | // (at your option) any later version.
|
---|
| 10 | //
|
---|
| 11 | // This program is distributed in the hope that it will be useful,
|
---|
| 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
| 14 | // GNU General Public License for more details.
|
---|
| 15 | //
|
---|
| 16 | // You should have received a copy of the GNU General Public License
|
---|
| 17 | // along with this program; if not, write to the Free Software
|
---|
| 18 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
---|
| 19 |
|
---|
| 20 | // nlo includes
|
---|
| 21 | #include "../include/fastjet/internal/BasicRandom.hh"
|
---|
| 22 |
|
---|
| 23 |
|
---|
| 24 | FASTJET_BEGIN_NAMESPACE // defined in fastjet/internal/base.hh
|
---|
| 25 |
|
---|
| 26 |
|
---|
| 27 | //
|
---|
| 28 | // random number generator
|
---|
| 29 | // uses method of L'Ecuyer, (via F.James, comp. phys. comm. 60(1990)329)
|
---|
| 30 | //
|
---|
| 31 | int __default_random_generator(int *__iseed)
|
---|
| 32 | {
|
---|
| 33 | int __k = __iseed[0]/53668;
|
---|
| 34 | __iseed[0] = (__iseed[0] - __k*53668)*40014 - __k*12211;
|
---|
| 35 | if(__iseed[0] < 0) __iseed[0] += 2147483563;
|
---|
| 36 |
|
---|
| 37 | __k = __iseed[1]/52774;
|
---|
| 38 | __iseed[1] = (__iseed[1] - __k*52774)*40692 - __k*3791;
|
---|
| 39 | if(__iseed[1] < 0) __iseed[1] += 2147483399;
|
---|
| 40 |
|
---|
| 41 | int __iz = __iseed[0] - __iseed[1];
|
---|
| 42 | if(__iz < 1) __iz += 2147483562;
|
---|
| 43 |
|
---|
| 44 | return __iz;
|
---|
| 45 | }
|
---|
| 46 |
|
---|
| 47 | // global defined random number generator
|
---|
| 48 | BasicRandom<int> _G_random_int;
|
---|
| 49 | BasicRandom<double> _G_random_double;
|
---|
| 50 |
|
---|
| 51 |
|
---|
| 52 | FASTJET_END_NAMESPACE
|
---|
| 53 |
|
---|