added random.seed(0) for determinism