C Library Functions  - 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
Examples
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.

EXAMPLES

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

Results:

 >   1223490636
 >    730990195
 >   1030677782
 >   1440331359
 >    235485591
 >   2084196099
 >    766055354
 >   1140745811
 >   1912226401
 >     18044253
 >
 >   1223490636
 >    730990195
 >   1030677782
 >   1440331359
 >    235485591
 >   2084196099
 >    766055354
 >   1140745811
 >   1912226401
 >     18044253
 >

SEE ALSO

drand48(3c), random(3c)


Nemo Release 3.1 system_srand (3) June 29, 2025
Generated by manServer 1.08 from 2f864b32-7609-465b-a87d-dc63e17477a1 using man macros.