fixed a bug on randomSuccessor. It was too slow due to unnecessary memory allocation