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_srandResults:
> 1223490636 > 730990195 > 1030677782 > 1440331359 > 235485591 > 2084196099 > 766055354 > 1140745811 > 1912226401 > 18044253 > > 1223490636 > 730990195 > 1030677782 > 1440331359 > 235485591 > 2084196099 > 766055354 > 1140745811 > 1912226401 > 18044253 >
drand48(3c), random(3c)
Nemo Release 3.1 | system_srand (3m_system) | March 07, 2025 |