~maddevelopers/mg5amcnlo/3.0.1

« back to all changes in this revision

Viewing changes to MG4_DECAY/ran1.f

move ./decay to ./mg5decay; resolve unit tests (n.b. __init__ does not check keys of input dictionaries, followed last revision)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
      function xran1(idum)
2
 
      dimension r(97)
3
 
      parameter (m1=259200,ia1=7141,ic1=54773,rm1=3.8580247e-6)
4
 
      parameter (m2=134456,ia2=8121,ic2=28411,rm2=7.4373773e-6)
5
 
      parameter (m3=243000,ia3=4561,ic3=51349)
6
 
      data iff /0/
7
 
      save r, ix1,ix2,ix3
8
 
      if (idum.lt.0.or.iff.eq.0) then
9
 
        iff=1
10
 
        ix1=mod(ic1-idum,m1)
11
 
        ix1=mod(ia1*ix1+ic1,m1)
12
 
        ix2=mod(ix1,m2)
13
 
        ix1=mod(ia1*ix1+ic1,m1)
14
 
        ix3=mod(ix1,m3)
15
 
        do 11 j=1,97
16
 
          ix1=mod(ia1*ix1+ic1,m1)
17
 
          ix2=mod(ia2*ix2+ic2,m2)
18
 
          r(j)=(float(ix1)+float(ix2)*rm2)*rm1
19
 
11      continue
20
 
        idum=1
21
 
      endif
22
 
      ix1=mod(ia1*ix1+ic1,m1)
23
 
      ix2=mod(ia2*ix2+ic2,m2)
24
 
      ix3=mod(ia3*ix3+ic3,m3)
25
 
      j=1+(97*ix3)/m3
26
 
      if(j.gt.97.or.j.lt.1)then
27
 
         write(*,*) 'j is bad in ran1.f',j, 97d0*ix3/m3
28
 
         STOP
29
 
      endif
30
 
      xran1=r(j)
31
 
      r(j)=(float(ix1)+float(ix2)*rm2)*rm1
32
 
      return
33
 
      end