In Windows, use rand() % int instead of ::random(int).