Random Number Generator

◀ Useful Functions▶ Parsing a string
Amazon Here is how to make a random number generator with seed being current date and time:
#include <ctime>  /* or <time.h> for time() */
#include <stdlib.h>  /* for srand() and rand() */
srand(time(0));  /* set up random number generator based on current time */
int random = rand() % 10;    /* from 0 to 9 inclusively */
rand() produces a random integer ranged from 0 to RAND_MAX, which is defined in <stdlib.h>.
◀ Useful Functions▶ Parsing a string

fShare
Questions? Let me know!