Changed randomization to not use C++11 functions