Random generator != null checks added. LearningRule simplified