与えたシード列またはシステム時刻からFortran乱数生成器を初期化する。
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=i32), | intent(in), | optional | :: | seed(:) |
subroutine seed_rng(seed) integer(i32), intent(in), optional :: seed(:) integer :: n, i, clk integer, allocatable :: put(:) call random_seed(size=n) allocate (put(n)) if (present(seed)) then do i = 1, n put(i) = seed(mod(i - 1, size(seed)) + 1) + 104729*i end do else call system_clock(count=clk) do i = 1, n put(i) = clk + 37*i end do end if call random_seed(put=put) end subroutine seed_rng