Despite seeding the rand() every time I call the two functions, they always repeat the same output
#include <iostream>
#include <cstdlib>
#include <unistd.h>
using namespace std;
void test1(){
srand(time(0));
int i = rand()%10;
cout << i << endl;
}
void test2(){
srand(time(NULL));
int l = rand()%10;
cout << l << endl;
}
int main(){
test1();
test2();
return 0;
}
output: 0 0
output 2: 4 4
output 3: 1 1
Any help would be greatly appreciated!