on-internet
← Community

Which C++ random number engines have a O(1) discard function?

Stack Overflow ·

Since C++11 there are a number of std random number engines. One of the member functions they implement is void discard(int long long z) which skips over z randomly generated numbers. The complexity of this function is given as O(z) on www.cplusplus.com (http://www.cplusplus.com/reference/random/mersenne_twister_engine/discard/) However, on www.cppreference.com (http://en.cppreference.com/w/cpp/numeric/random/mersenne_twister_engine/discard) there is a note to say that For some engines, "fast jump" algorithms are known, which advancing the state by many steps (order of millions) without calcul

Comments

Sign in or sign up to comment and upvote.

No comments yet.