finished the problem set 2, with randomization and everything else