Improved rng class