Update function.cpp

chance1 and chance2 were based on the same random number. Fixed.