C++ has had a few options since C++11[1].
- Linear congruential generator[2]:
xₜ = a xₜ₋₁ + c mod m
- Mersenne Twister[3]: too complicated for a few lines
- Subtract with carry[3]: k < p
carryₜ = [xₜ₋ₖ - xₜ₋ₚ - carryₜ₋₁ < 0]
xₜ = xₜ₋ₖ - xₜ₋ₚ - carryₜ₋₁ mod 2ⁿ
All three algorithms are fairly popular.(Please excuse the unidiomatic index and constant names, I'm at the mercy of unicode)
[1]: https://en.cppreference.com/w/cpp/header/random
[2]: https://en.wikipedia.org/wiki/Linear_congruential_generator