Get rid of c++11 requirement, by using C random()