def WichmannHill1982():
    """
    Algorithm AS 183 Appl. Statist. (1982) vol.31, no.2

    Returns a pseudo-random number rectangularly distributed
    between 0 and 1.   The cycle length is 6.95E+12 (See page 123
    of Applied Statistics (1984) vol.33), not as claimed in the
    original article.

    ix, iy and iz should be set to integer values between 1 and
    30000 before the first entry.

    Integer arithmetic up to 5212632 is required.
    """
    import numpy as np
    global ix, iy, iz
    ix = 171 * ix % 30269
    iy = 172 * iy % 30307
    iz = 170 * iz % 30323
    """
    If integer arithmetic only up to 30323 (!) is available, the preceding
    3 statements may be replaced by:

    ix = 171 * (ix % 177) -  2 * (ix / 177)
    iy = 172 * (iy % 176) - 35 * (iy / 176)
    iz = 170 * (iz % 178) - 63 * (iz / 178)

    if ix < 0:
        ix = ix + 30269
    if iy < 0:
        iy = iy + 30307
    if iz < 0:
        iz = iz + 30323
    """
    return np.remainder(np.float(ix) / 30269.0 + np.float(iy) / 30307.0 + 
        np.float(iz) / 30323.0, 1.0)
