i have been trying to make program that prints random string out of string array. But it is throwing nothing.
I have chaged random number generator algorythm, but it printed same string every time. So i made test aplication and it doesnt work anymore. Here is my code:
#include <iostream>
using namespace std;
int randomNumber(int min, int max) {
int x = min + rand() % max;
return x;
}
int main() {
string lmao[] = {"xd", "hahaha",",","fjdskl", "fjdskl", "fjkdsljfkdsl","uuruur","fjdksl"};
string lastZ = "";
for (int i = 0; i <= 10; i++) {
int x = sizeof(lmao) / sizeof(int);
int y = randomNumber(0, x);
string z = lmao[y];
if (z == lastZ) {
cout << "Fail";
}
else {
lastZ = z;
cout << "Succes";
}
}
return 0;
}