I am trying to write a code to return random character so I write the following code:
static char prepare-data()
{
Sleep(rand()%500); // sleep random amount
int n = rand()%26;
char c = (char)(n+65);
return c; // return random character
}
static void writer()
{
int i, writePt = 0;
char data;
for (i = 0; i < data_length; i++)
{
data = preparedata(); // go off & get data ready
buffers[writePt] = data; // put data into buffer
cout<<"writer thread: buffer["<<writePt<<"]="<<data<<endl;
writePt = (writePt + 1) % num_total_buffer;
}
}
but every time I run the code I get the same characters is this considered as problem