modify redesign to fix misuse of random
modify redesign to fix malfunction