Clicky
Showing changes from revision #6 to #7:
(追記) Added (追記ここまで) | (削除) Removed (削除ここまで) | (削除) Chan (削除ここまで)(追記) ged (追記ここまで)
Restarts or queries the state of the pseudorandom number generator used by random_number
.
If random_seed
is called without arguments, it is seeded with random data retrieved from the operating system.
Fortran 95 and later
Subroutine
call random_seed([size, put, get])
size
- (Optional) Shall be a scalar and of type default integer
, with intent(out)
. It specifies the minimum size of the arrays used with the put
and get
arguments.
put
- (Optional) Shall be an array of type default integer
and rank one. It is intent(in)
and the size of the array must be larger than or equal to the number returned by the size
argument.
get
- (Optional) Shall be an array of type default integer
and rank one. It is intent(out)
and the size of the array must be larger than or equal to the number returned by the size
argument.
program test_random_seed
implicit none
integer, allocatable :: seed(:)
integer :: n(削除) , (削除ここまで)(削除) (削除ここまで)(削除) i (削除ここまで)
call random_seed(size = n)
allocate(seed(n))
call random_seed(get=seed)
write (*, *) seed
end program test_random_seed