I have for example "asd" and I want it to be randomized to DAS, DSA, SAD, you know. How can I code this? Tried a few solutions but It didnt really work.
#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
#include <string.h>
int main()
{
printf("type in the word\n");
char haslo[128];
scanf("%s", haslo);
char set[128];
char hasloa[128];
strcpy(set, haslo);
unsigned int Ind = 0;
srand(time(NULL) + rand());
int len = strlen(set);
while(Ind < len)
{
hasloa[Ind++] = set[rand()%62];
}
hasloa[len] = '\0';
printf("%s", hasloa);
return 0;
}
Aucun commentaire:
Enregistrer un commentaire