Fix util.random and unit test for it.