//A pseudo-random number generator, returns value between
// 0 and max specified by user


def generator is public, readable = object{
    var nSeed:Number := 5323
    method next(max:Number)->Number is public{
        nSeed := 1103515245 * nSeed + 12345
        nSeed := nSeed % 32767
        return nSeed % max
    }
}