Random number generator in c with max and min -


possible duplicate:
in c, how specific range of numbers rand()?

#include <stdio.h> #include <stdlib.h> #include <time.h>  int main(int argc, char** argv) {   srand(time(null)); int r = rand();  printf("%d\n", r);  return (exit_success); } 

i have code , want make random numbers 1-6 , fill them board [40] ideas?

int main(int argc, char** argv) {     int i;     int array[40];     srand(time(null));     (i=0; i<40; i++)         array[i] = rand()%6 + 1     return (exit_success);   } 

Comments

Popular posts from this blog

django - How can I change user group without delete record -

java - Need to add SOAP security token -

java - EclipseLink JPA Object is not a known entity type -