jeudi 3 décembre 2015

Can't change total number of randoms

My Code:

#include <stdio.h>
#include <stdlib.h>

int main()
{ 
    int z,x,y=0;
    char word[10];

    for(z=0; z <1; z++)
    {
        y=3+rand() % 7; 

        for(x=0; x<y ; x++){
            word[x]= rand()%26+'a';   
        }

        printf("%s\n\n",word);   
    }
}

It gives me letters randomly but I couldn't figure out how to make random their number. Substitutions must be between 5-10.

For example:

  • 1st try: xjhdhfe
  • 2nd try: ytfxsszp
  • 3rd try: qwety



Aucun commentaire:

Enregistrer un commentaire