When std::seed_seq is constructed from random access iterators we can detect the internal vector size in O(1). Reserving memory for elements in such cases may avoid multiple memory allocations. libstdc++-v3/ChangeLog: * include/bits/random.tcc: Optimize seed_seq construction. -- Best regards, Antony Polukhin