Logo

Programming-Idioms

History of Idiom 69 > diff from v35 to v36

Edit summary for version 36 by tkoenig:
New Fortran implementation by user [tkoenig]

Version 35

2019-09-26, 20:44:14

Version 36

2019-09-27, 22:40:57

Idiom #69 Seed random generator

Use seed s to initialize a random generator.

If s is constant, the generator output will be the same each time the program runs. If s is based on the current value of the system clock, the generator output will be different each time.

Idiom #69 Seed random generator

Use seed s to initialize a random generator.

If s is constant, the generator output will be the same each time the program runs. If s is based on the current value of the system clock, the generator output will be different each time.

Code
  call random_seed(size = n)
  allocate(seed(n))
  ! ...
  call random_seed(put=seed)
Comments bubble
seed is an allocatable variable.