sgrnd Subroutine

subroutine sgrnd(seed)

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: seed

Calls

proc~~sgrnd~~CallsGraph proc~sgrnd sgrnd mt mt proc~sgrnd->mt

Source Code

subroutine sgrnd(seed)
  ! Setting initial seeds to mt[N] using the generator Line 25 of Table 1 in
  ! [KNUTH 1981, The Art of Computer Programming Vol. 2 (2nd Ed.), pp102]
  integer,intent(in) :: seed    
  mt(0) = iand(seed,-1)
  do mti=1,N-1
     mt(mti) = iand(69069 * mt(mti-1),-1)
  enddo
  return
end subroutine sgrnd