source: trunk/source/processes/hadronic/models/incl/src/G4Ranecu.cc@ 1201

Last change on this file since 1201 was 968, checked in by garnier, 17 years ago

fichier ajoutes

File size: 2.6 KB
RevLine 
[968]1//
2// ********************************************************************
3// * License and Disclaimer *
4// * *
5// * The Geant4 software is copyright of the Copyright Holders of *
6// * the Geant4 Collaboration. It is provided under the terms and *
7// * conditions of the Geant4 Software License, included in the file *
8// * LICENSE and available at http://cern.ch/geant4/license . These *
9// * include a list of copyright holders. *
10// * *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work make any representation or warranty, express or implied, *
14// * regarding this software system or assume any liability for its *
15// * use. Please see the license in the file LICENSE and URL above *
16// * for the full disclaimer and the limitation of liability. *
17// * *
18// * This code implementation is the result of the scientific and *
19// * technical work of the GEANT4 collaboration. *
20// * By using, copying, modifying or distributing the software (or *
21// * any work based on the software) you agree to acknowledge its *
22// * use in resulting scientific publications, and indicate your *
23// * acceptance of all terms of the Geant4 Software license. *
24// ********************************************************************
25//
26// $Id: G4Ranecu.cc,v 1.3 2008/06/25 17:20:04 kaitanie Exp $
27// Translation of INCL4.2/ABLA V3
28// Pekka Kaitaniemi, HIP (translation)
29// Christelle Schmidt, IPNL (fission code)
30// Alain Boudard, CEA (contact person INCL/ABLA)
31// Aatos Heikkinen, HIP (project coordination)
32
33#include "G4Ranecu.hh"
34
35G4Ranecu::G4Ranecu()
36{
37 iseed1 = 666;
38 iseed2 = 777;
39}
40
41G4Ranecu::~G4Ranecu()
42{
43
44}
45
46G4double G4Ranecu::getRandom()
47{
48 // This is an adapted version of subroutine ranecu:
49 // A. Padal, J. Sempau Computer Physics Cummunications 175 (2006) 440-450
50
51 // implicit double precision (a-h,o-z), integer*4 (i-n)
52 // common/rseed/iseed1,iseed2
53 G4double uscale=1.0/2.147483563e9;
54
55 G4long i1=iseed1/53668;
56 iseed1=40014*(iseed1-i1*53668)-i1*12211;
57
58 if(iseed1 < 0) iseed1 = iseed1 + 2147483563;
59
60 G4long i2=iseed2/52774;
61 iseed2=40692*(iseed2-i2*52774)-i2*3791;
62 if(iseed2 < 0) iseed2=iseed2+2147483399;
63
64 G4long iz=iseed1-iseed2;
65 if(iz < 1) iz=iz+2147483562;
66
67 return iz*uscale;
68}
Note: See TracBrowser for help on using the repository browser.