probability should be double; also, it should be param of 'fail' function, no need to define it here