Reversible pseudo-random sequence generator

I asked a very similar question at the tigsource forums. Hashing At least in games, a hash function could probably do what you want. You could do it like this class ReversibleRNG { int x; public: ReversibleRNG(int seed) : x(seed) {} int next(){return yourFavoriteHash(++x);} int prev(){return yourFavoriteHash(–x);} }; Reversible linear congruential generator (lcg) As multiple … Read more