changed the randomization functions