Fix broken build due to typos and change of random generator