std::rand replacement for C++