mtprng or abs() problem; g95

From: Lucian Anton (antonl22_at_yahoo.com)
Date: 10/29/04


Date: 29 Oct 2004 11:43:06 -0700

I tried to obtain a random integer between 1,L using the line

ir=mod(abs(mtprng_rand(state)),L)+1

where mtprng_rand(state) is the 32 bit integer random number
 generator of the mtprng package (available at
http://www.coyotegulch.com/products/libcoyotl/twisted_road/#Item4c)

Inspecting a segmentation fault I have found that
mtprng_rand(state)) hits the value -2147483648 (-2^{-31}) and

abs(-2147483648)= -2147483648 in g95 !!

Probable the fault is with mtprng_rand(state) function which shoudn't
hit this value, but abs() is not friendly in this situation. I am
still baffled. Could an expert help with some comments?

Yours,

Lucian Anton
School of Chemical Engineering
Manchester Unversity, UK

email antonl22 -> yahoo.com