Replaced exception by error() in RNG.