Smooth Particle Applied Mechanics: The State of the Art

Symmetry breaking perturbations are often desirable. Generating them with a simple and portable random-number routine is a real convenience. In the typical case illustrated here each call of the routine generates a new number in the interval from 0 to l. For colleagues who wish to reproduce each other's work it is necessary that the "random" numbers each uses follow exactly the same sequence. For this purpose we use the following simple function randnum(intx,inty), which returns a new random number, randnum, as well as two corresponding integers intx and inty, each time the function is called:
c This is a function to generate a random number function randnum(intx,inty)<span class="beginpage"> pagenum="118"><a name="222"></a><a name="IDX-118"></a></span> implicit double precision (a-h,o-z) i = 1029*intx + 1731 j = i + 1029*inty + 507*intx - 1731 intx = mod(i,2048) j = j + (i - intx)/2048 inty = mod(j,2048) randnum = (intx + 2048*inty)/4194304.0d00 return end
This function generates decimal approximations to rational fractions between 0 and 1 . The numerator is a 22-bit integer (equivalent to a 2-digit base-2048 integer) and the denominator is 2 22 = 2048 2 = 4,194,304 . Each...