#include <stdlib.h>
#include <iostream>
#include <stdio.h>
#include <time.h>
#include <chrono>
#include <random>
using namespace std;
#define TamA 10000000
#define TamM 20000001
bool Existe(int Valores[], int tam, int valor) {//chama a fun??o existe e passa o vetor de valores o vetor que tem todos os valores
//tam tamnho do vetor / verifica se o valor ta no vetor - pecore todo o vetor
for (int i = 0; i < tam; i++) {
if (Valores[i] == valor)
return true;
}
return false;
}
void GeraAleatorios(int numeros[], int quantNumeros, int Limite) {
srand(time_t(NULL));
unsigned long int v;
unsigned seed = std::chrono::system_clock::now().time_since_epoch().count();
std::minstd_rand0 generator(seed); // minstd_
for (int i = 0; i < quantNumeros; i++) {
v = generator()%TamM;
while(Existe(numeros, i, v)) {
v = generator()%TamM;
}
numeros[i] = v;
printf("%d- ", v);
}
}
int main()
{
FILE* geRar;
geRar = fopen("C:\\Users\\Vinicyo092\\Downloads\\Numeros10kk.txt", "w");
//int numeros[TamA];
int* numeros;
numeros = (int*)malloc(TamM * sizeof(int));
GeraAleatorios(numeros, TamA, TamM);
for (int i = 0; i < TamA; i++) {
fprintf(geRar, "%d ", numeros[i]);
printf("%d ", numeros[i]);
}
return 0;
}
Consegui fazer utilizando o código acima, muito obrigado a todos que me ajudaram.