Open
Description
There are several algorithms that might be good for benchmarks:
- random numbers from the normal distribution: https://github.com/certik/hfsolver/blob/b4c50c1979fb7e468b1852b144ba756f5a51788d/src/random.f90#L25
- gamma distribution: https://github.com/certik/hfsolver/blob/b4c50c1979fb7e468b1852b144ba756f5a51788d/src/random.f90#L68
- https://github.com/vmagnin/exploring_coarrays/blob/66b9ee5483b81bdc11c67642e918068b6e1bb821/pi_monte_carlo_co_sum.f90 (background post)
LCG algorithm:
subroutine lcg_int32(x)
! Linear congruential generator
! https://en.wikipedia.org/wiki/Linear_congruential_generator
integer(int32), intent(out) :: x
integer(int32), save :: s = 26250493
s = modulo(s * 48271, 2147483647)
x = s
end subroutine
subroutine lcg_real32(x)
real(real32), intent(out) :: x
integer(int32) :: s
call lcg_int32(s)
x = s / 2147483647._real32
end subroutine
Metadata
Metadata
Assignees
Labels
No labels