Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //headers
- #include <time.h>
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- //random strings
- const char letterz[] = "ABCDEFGHIJKLMNOPQRSTUVWUXYZ1234567890-_*&%$#@!><";
- int hack(int RSS) { return rand() % RSS; }
- char *RS(int length) {
- char *str = malloc((length + 1) * sizeof(char));
- int i;
- for (i = 0; i < length; i++) {
- str[i] = letterz[hack(strlen(letterz))];
- }
- str[length] = '\0';
- return str;
- }
- int main() {
- srand(time(NULL));
- char *random;
- random = RS(10);
- printf("%s\n", random);
- free(random);
- }
Add Comment
Please, Sign In to add comment