Command To Generate Random Number In C Needed

Asked By 0 points N/A Posted on -
qa-featured

I need the command to generate random number in c for security and encryption purpose and I need it urgently. Guys help me in this and tell me the command. Thanks.

SHARE
Answered By 0 points N/A #300936

Command To Generate Random Number In C Needed

qa-featured

If you want to generate random number in c for security or encryption purpose, you can use the following commands lines-

#include<time.h>

#include<stdlib.h>

srand(time(NULL));

int r = rand();

The command returns pseudo random integer between 0 and RAND_MAX. As an option you can use Rand() but it’s not secure enough for the purpose you need. It should be used only one in command.

Login/Register to Answer

Related Questions