Commit 9685cb46 authored by Matthias Redies's avatar Matthias Redies

this is THE worst random number generator every. Who wrote this?

parent dba4ae41
...@@ -14,7 +14,6 @@ math/inwint.f ...@@ -14,7 +14,6 @@ math/inwint.f
math/matmul.f math/matmul.f
math/outint.f math/outint.f
math/points.f math/points.f
math/qranf.f
math/qsf.f math/qsf.f
math/rfft.F math/rfft.F
math/sphbes.f math/sphbes.f
...@@ -23,6 +22,7 @@ math/util.F ...@@ -23,6 +22,7 @@ math/util.F
math/difcub.f math/difcub.f
) )
set(fleur_F90 ${fleur_F90} set(fleur_F90 ${fleur_F90}
math/qranf.f90
math/differentiate.f90 math/differentiate.f90
math/fft2d.F90 math/fft2d.F90
math/fft3d.f90 math/fft3d.f90
......
MODULE m_qranf MODULE m_qranf
CONTAINS CONTAINS
REAL FUNCTION qranf(x,j) REAL FUNCTION qranf(x,j)
c ********************************************************** ! **********************************************************
c quasi random generator in the interval (0.,1.) ! quasi random generator in the interval (0.,1.)
c ********************************************************** ! **********************************************************
IMPLICIT NONE IMPLICIT NONE
C .. Scalar Arguments .. ! .. Scalar Arguments ..
REAL x REAL x
INTEGER j INTEGER j
C .. ! ..
C .. Intrinsic Functions .. ! .. Intrinsic Functions ..
INTRINSIC aint INTRINSIC aint
C .. ! ..
j = j + 1 j = j + 1
qranf = j*x qranf = j*x
qranf = qranf - aint(qranf) qranf = qranf - aint(qranf)
RETURN RETURN
END FUNCTION END FUNCTION
END END
  • Hey, this will be initialized with x=sqrt(13) after all!

  • When it's called it uses the same x and j throughout the whole loop. I don't know what it does but I have a suspicion it's wrong.

  • No, j actually is increased by one each time this is called. Thus "quasi-random" numbers are generated... :-)

  • If this keeps failling i will just revert it. It seems to work or fail fairly randomly.

Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment