Function getCurrentGeneration