added random check for factorial