are you sure it's not displaying? i tried it, and its working for me.
try this, with the std::cout output we'll know if rand() is working as it should.
using namespace sf;
int main()
{
const sf::Color colorArray[5]={sf::Color::Cyan, sf::Color::Blue, sf::Color::Green, sf::Color::Red, sf::Color::Yellow };
srand(time(NULL));
RenderWindow window(VideoMode(200, 200), "Blocks");
RectangleShape block(Vector2f(16, 16));
std::cout << rand()%5;
block.setFillColor(colorArray[rand()%5]);
while (window.isOpen())
{
sf::Event event;
while (window.pollEvent(event))
{
if (event.type == sf::Event::Closed)
window.close();
}
window.clear();
block.setPosition(0, 0);
window.draw(block);
window.display();
}
return 0;
}