OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gfortran.fortran-torture/] [execute/] [random_1.f90] - Blame information for rev 711

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 695 jeremybenn
! PR15619
2
! Check that random_seed works as expected.
3
! Does not check the quality of random numbers, hence should never fail.
4
program 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)) call abort
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)) call abort
31
end program
32
 
33
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.