system_srand(3f) - [M_system:PSEUDORANDOM] set seed for pseudo-random number generator system_rand(3f) (LICENSE:PD)
Synopsis
Description
Examples
See Also
subroutine system_srand()
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.
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_srandexpected results:
1512084687 1329390995 1874040748 60731048 239808950 2017891911 22055588 1105177318 347750200 17296453551512084687 1329390995 1874040748 60731048 239808950 2017891911 22055588 1105177318 347750200 1729645355
drand48(3c), random(3c)
Nemo Release 3.1 | system_srand (3) | February 23, 2025 |