mastodon.zunda.ninja is one of the many independent Mastodon servers you can use to participate in the fediverse.
Zundon is a single user instance as home of @zundan as well as a test bed for changes of the code.

Administered by:

Server stats:

1
active users

zunda

$ cat shuffle.c
<stdlib.h>
<stdio.h>
<ctype.h>
<time.h>

utf8_head(c) (((c) & 0xC0) != 0x80)

int
main(void)
{
char input[BUFSIZ], *runes[BUFSIZ];
char output[BUFSIZ];
size_t len, i, j;
char *ptr;

fgets(input, sizeof(input), stdin);
fclose(stdin);

ptr = input;
while(*ptr) {
if (utf8_head(*ptr) && *ptr != '\n') {
runes[len] = ptr;
len++;
}
ptr++;
}

srand((unsigned)time(NULL));
for(i = 0; i < len - 1; i++) {
j = i + rand() % (len - i);
ptr = runes[j];
runes[j] = runes[i];
runes[i] = ptr;
}

ptr = output;
for(i = 0, ptr = output; i < len; i++) {
j = 0;
do {
*ptr = *(runes[i] + j);
j++;
ptr++;
} while(!utf8_head(*(runes[i] + j)));
}
*ptr = '\n';
*(ptr + 1) = '\0';

fputs(output, stdout);
return EXIT_SUCCESS;
}
$ gcc -Wall shuffle.c && echo ねむいね | ./a.out
いむねね

むっちゃ長くなったw