Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | seed |
SUBROUTINE initialize_random(seed)
USE omp_lib
IMPLICIT NONE
INTEGER, INTENT(IN) :: seed
INTEGER :: num_threads
INTEGER :: thread_num
num_threads = OMP_GET_MAX_THREADS()
IF (.NOT. ALLOCATED(states)) THEN
ALLOCATE(states(0:num_threads - 1))
END IF
!$OMP PARALLEL PRIVATE(thread_num)
thread_num = OMP_GET_THREAD_NUM()
states(thread_num) = random_construct_U(seed + thread_num)
!$OMP END PARALLEL
END SUBROUTINE initialize_random