Changed to use better random number generator code (Simpler!).