start of a major rewrite

This commit is contained in:
nova
2026-05-05 19:41:45 +02:00
parent b639ad3998
commit e5625ada08
12 changed files with 395 additions and 941 deletions

View File

@@ -117,18 +117,21 @@ int sort_random(const void *file0, const void *file1){
if (!(((file*)file0)->file_type & FILE_TYPE_DIR) && (((file*)file1)->file_type & FILE_TYPE_DIR)) {
return 1;
}
time_t num = ((time_t)&sort_random) + (time_t)seed + getpid();
/* seed is the only value that actually changes whenever this funcion is called.
* seed only updates when the order_by binding is executed.
* this means that the random output only changes on the command of the user, and not SETTINGS_RELOAD_DIR_DELTA, this is intentional.
* well the other stuff like file sizes and file count in a dir may also change, but this needs user intervention too.
* that is unless the user decides to sort random in /var/log or something, which begs the question: why would you do that?
*/
time_t num = (((time_t)&sort_random) + (time_t)seed) ^ (((file*)file0)->file_size + ((file*)file1)->file_size);
int i;
for (i = 1; i < (((time_t)&seed)%10); i++) {
num += getpid() / seed;
num ^= num << ((((time_t)seed)%11)+i);
num += ((file*)file0)->file_size;
num ^= num >> ((((time_t)seed)%7)+i);
num -= ((file*)file1)->file_size;
for (i = 1; i < (((time_t)&getpid)%3); i++) {
num ^= num << ((((time_t)&file0)%27)+i);
num ^= num >> ((((time_t)&file1)%18)+i);
num ^= ((time_t)&getpid) ^ (((time_t)&getpid) >> ((time_t)getpid())%10);
}
/*printf("%ld\n", ((num & (3 << seed%16)) >> seed%16) - 1);*/
return (((num & (3 << seed%32)) >> seed%32) - 1);
return (((num & (3 << seed%16)) >> seed%16) - 1);
/*return ((num%3) - 1);*/
}