Soo last year, if im not mistaken , i asked for help with the random numbers generator.
I didn't do C++ for quite some time, but i started again.
So here is what i have :
#include "stdafx.h"
#include <iostream>
#include <fstream>
#include <ctime>
using namespace std;
int main(){
srand(time(NULL));
int random;
ofstream outfile("C:\\Random.txt"); //Random as in you can put any file you want
if (outfile.is_open())
{
for (int i = 0; i < 10; i++)
{
random=(rand()%100);
outfile << i << ": " << random <<endl;
}
}
outfile.close();
return 0;
}
The code is supposed to write 10 random numbers to a file. I know its noot good after the "for" part
because for now it only generates from 0-100.
Can someone help me with this code?
It supposed to generate random numbers between 0 and 32000 (not sure how much rand exactly is ) its somewhere around 32000-33000 i think i forgot it.
Tnx