4
1
mirror of https://github.com/pfloos/quack synced 2024-11-13 01:23:59 +01:00
quack/src/MC/initialize_random_generator.f90

26 lines
489 B
Fortran
Raw Normal View History

2019-03-19 10:13:33 +01:00
subroutine initialize_random_generator(iSeed)
! Initialize random number generator
implicit none
! Input variables
integer,intent(in) :: iSeed
! Local variables
integer,allocatable :: Seed(:)
integer :: nSeed
call random_seed(size = nSeed)
allocate(Seed(nSeed))
call random_seed(get=Seed)
if(iSeed /= 0) then
Seed = 0
Seed(1) = iSeed
endif
call random_seed(put=Seed)
end subroutine initialize_random_generator