1! PR15619 2! Check that random_seed works as expected. 3! Does not check the quality of random numbers, hence should never fail. 4program test_random 5 implicit none 6 integer, allocatable :: seed(:) 7 real, dimension(10) :: a, b 8 integer n; 9 10 call random_seed (size=n) 11 allocate (seed(n)) 12 13 ! Exercise the generator a bit. 14 call random_number (a) 15 16 ! Remeber the seed and get 10 more. 17 call random_seed (get=seed) 18 call random_number (a) 19 20 ! Get the same 10 numbers in two blocks, remebering the seed in the middle 21 call random_seed (put=seed) 22 call random_number (b(1:5)) 23 call random_seed(get=seed) 24 call random_number (b(6:10)) 25 if (any (a .ne. b)) STOP 1 26 27 ! Get the last 5 numbers again. 28 call random_seed (put=seed) 29 call random_number (b(6:10)) 30 if (any (a .ne. b)) STOP 2 31end program 32 33 34