Improved random generator class