Clicky

Fortran Wiki
random_seed (changes)

Skip the Navigation Links | Home Page | All Pages | Recently Revised | Authors | Feeds | Export |

Showing changes from revision #6 to #7: (追記) Added (追記ここまで) | (削除) Removed (削除ここまで) | (削除) Chan (削除ここまで)(追記) ged (追記ここまで)

Description

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.

Standard

Fortran 95 and later

Class

Subroutine

Syntax

call random_seed([size, put, get])

Arguments

  • 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.

Example

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

See also

random_number, random_init

category: intrinsics

Revised on May 16, 2019 12:45:47 by Jason Blevins (128.146.137.252) (1451 characters / 0.0 pages)
Edit | Back in time (6 revisions) | Hide changes | History | Views: Print | TeX | Source | Linked from: Intrinsic procedures, random_number, random_init

AltStyle によって変換されたページ (->オリジナル) /