modified def flip_coin() to allow a custom random number generator. if none is given, use default (0)
added random number generator support. send a custom random number generator and it will use it for the sim.