EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
hirnd2.f
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file hirnd2.f
1 C
2 C
3 C
4 C
5 C This generate random number between XMIN and XMAX
6  FUNCTION hirnd2(I,XMIN,XMAX)
7  common/hijhb/rr(10,201),xx(10,201)
8  SAVE /hijhb/
9  common/ranseed/nseed
10  SAVE /ranseed/
11  IF(xmin.LT.xx(i,1)) xmin=xx(i,1)
12  IF(xmax.GT.xx(i,201)) xmax=xx(i,201)
13  jmin=1+200*(xmin-xx(i,1))/(xx(i,201)-xx(i,1))
14  jmax=1+200*(xmax-xx(i,1))/(xx(i,201)-xx(i,1))
15  rx=rr(i,jmin)+(rr(i,jmax)-rr(i,jmin))*atl_ran(nseed)
16  jl=0
17  ju=202
18 10 IF(ju-jl.GT.1) THEN
19  jm=(ju+jl)/2
20  IF((rr(i,201).GT.rr(i,1)).EQV.(rx.GT.rr(i,jm))) THEN
21  jl=jm
22  ELSE
23  ju=jm
24  ENDIF
25  go to 10
26  ENDIF
27  j=jl
28  IF(j.LT.1) j=1
29  IF(j.GE.201) j=200
30  hirnd2=(xx(i,j)+xx(i,j+1))/2.0
31  RETURN
32  END