Skip to content

Random number generation #21

Open
Open
@certik

Description

@certik

There are several algorithms that might be good for benchmarks:

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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions