Hello,
I am using a code to generate random numbers upto 32 char...
The problem is that i want to display the 32 characters each randomly because the code is displaying the same char 32 times and i want to get the 32 chars generated randomly...
The code is:-
#include <time.h>
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
using namespace std;
char RandomNumber()
{
//int counter = 0;
char a,b,c, random_char;
a='a';b='0';
//for (counter = 0; counter <1; counter++)
//{
srand(time(NULL));
random_char= (char) rand();
c=a+(random_char%b);
//cout <<c;
//}
return(c);
}
int main()
{
for(int j=0;j<32;j++){
char e;
e = RandomNumber();
cout<<e;}
return 0;
}
The output i am getting is: CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
and i want to get the 32 char different that is generated randomly each...
E.g: djh4652ghydfb45863mhggh4236muh2p