added self. and randomFact function