With Vector I can do push_back in a normal way in the for loop, but it's getting very fast. I'm trying to coding it, but I'm getting a few bugs. No error when is no timing. I couldn't fix it and couldn't find it on the Internet.
while (window.isOpen()) {
Time time = clock.getElapsedTime();
second = time.asSeconds();
for (int i = 0; i < randx.size(); i++) {
rect.setPosition(rand() % 300, rand() % 500);
if (second == 2) {
rectshape.push_back(rect);
clock.restart();
}
}