I
Ioannis Vranos
I want to create some random numbers for encryption purposes, and i wonder
if the following scheme makes it more hard to guess the underneath number
generation pattern, than the plain use of rand():
#include <cstdlib>
#include <ctime>
int GetRandomNumber()
{
using namespace std;
int depth=rand();
for(int i=0; i<depth; ++i)
rand();
return rand();
}
int main()
{
using namespace std;
srand(time(0));
int y=GetRandomNumber();
}
Does the above make any difference over plain use of rand()?
Regards,
Ioannis Vranos
if the following scheme makes it more hard to guess the underneath number
generation pattern, than the plain use of rand():
#include <cstdlib>
#include <ctime>
int GetRandomNumber()
{
using namespace std;
int depth=rand();
for(int i=0; i<depth; ++i)
rand();
return rand();
}
int main()
{
using namespace std;
srand(time(0));
int y=GetRandomNumber();
}
Does the above make any difference over plain use of rand()?
Regards,
Ioannis Vranos