2 ! { dg-require-effective-target fortran_large_real }
3 ! Check that the random_seed for real(10) exists and that
4 ! real(8) and real(10) random number generators
5 ! return the same sequence of values.
6 ! Mostly copied from random_2.f90
8 integer,parameter :: k
= selected_real_kind (precision (0.0_8
) + 1)
10 integer, dimension(:), allocatable
:: seed
11 real(kind
=8), dimension(10) :: r8
12 real(kind
=k
), dimension(10) :: r10
13 real, parameter :: delta
= 1.d
-10
16 ! Run the test only if real(10) is available. With the current
17 ! xorshift1024* PRNG the real(16) generator uses two uint64_t values
18 ! for every real(16) value generated, and hence the sequences won't
19 ! be the same as with real(4,8,10).
21 call random_seed (size
=n
)
23 call random_seed (get
=seed
)
24 ! Test both array valued and scalar routines.
25 call random_number(r8
)
26 call random_number (r8(10))
28 ! Reset the seed and get the real(8) values.
29 call random_seed (put
=seed
)
30 call random_number(r10
)
31 call random_number (r10(10))
33 if (any ((r8
- r10
) .gt
. delta
)) call abort