as for random numbers - random()
this should help (I use time for my seed number, otherwise you get the same seqence over and over because it defaults to seeding with 1)
Code: Select all
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
int main(void){
srandom(time(NULL));
int r=random();
//printf("rand_int is %d\nRAND_MAX is %d\n",r,RAND_MAX);
printf("random int from 0-50 is %d\n",(int)(50 * (float)r /(float)RAND_MAX + 0.5));
}
but as to the number series, that is mathematical logic which is better to figure out on your own (but here is a hint: use a random number to get the range and add it to the starting point)