[UP]


Manual Reference Pages  - system_srand (3)

NAME

system_srand(3f) - [M_system:PSEUDORANDOM] set seed for pseudo-random number generator system_rand(3f) (LICENSE:PD)

CONTENTS

Synopsis
Description
Example
See Also

SYNOPSIS

subroutine system_srand()

DESCRIPTION

system_srand(3f) calls the C routine srand(3c) The srand(3c)/system_srand(3f) function uses its argument as the seed for a new sequence of pseudo-random integers to be returned by system_rand(3f)/rand(3c). These sequences are repeatable by calling system_srand(3f) with the same seed value. If no seed value is provided, the system_rand(3f) function is automatically seeded with a value of 1.

EXAMPLE

Sample program:

      program demo_system_srand
      use M_system, only : system_srand, system_rand
      implicit none
      integer :: i,j
      do j=1,2
         call system_srand(1001)
         do i=1,10
            write(*,*)system_rand()
         enddo
         write(*,*)
      enddo
      end program demo_system_srand
expected results:

     1512084687
     1329390995
     1874040748
       60731048
      239808950
     2017891911
       22055588
     1105177318
      347750200
     1729645355

1512084687 1329390995 1874040748 60731048 239808950 2017891911 22055588 1105177318 347750200 1729645355

SEE ALSO

drand48(3c), random(3c)


system_srand (3) March 11, 2021
Generated by manServer 1.08 from a5f8a6ef-ffe3-41c5-a53f-6e7dcbe04f37 using man macros.