C Program To Generate Random Numbers Without Using Rand Code Example


Example 1: how to genrate a random number in C

#include <time.h> #include <stdlib.h>  srand(time(NULL));   // Initialization, should only be called once. int r = rand();      // Returns a pseudo-random integer between 0 and RAND_MAX.

Example 2: how to genrate a random number in C

srand(time(NULL));   int r = rand();

Comments

Popular posts from this blog

Converting A String To Int In Groovy

"Cannot Create Cache Directory /home//.composer/cache/repo/https---packagist.org/, Or Directory Is Not Writable. Proceeding Without Cache"

Android How Can I Convert A String To A Editable