I'm using C++ and I'm very new, but one of my latest troubles is using srand. Srand is outputting a gargantuan list of numbers until it moves to the next one. Here's my code so you can understand what I'm talking about
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <string>
using namespace std;
void function2()
{
int num;
string none;
string end1;
while (num != 69420)
{
srand((unsigned) time( NULL));
num = rand() % 100000 + 1;
cout << num << "\n";
}
if (num != 69420)
{
cout << "gg's";
cin >> end1;
}
}
int main()
{
int num;
string none;
while (num != 69420)
{
srand((unsigned) time( NULL));
num = rand() % 100000 + 1;
cout << "Press enter.";
getline(cin, none);
if (none == " ")
{
}
else
{
function2();
}
if (num != 69420)
{
break;
}
else
{
continue;
}
}
}
This probably isn't right and that's why I'm here. Thanks to anyone if you try to help me!