[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
Shuffle
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

You are currently reading a thread in /g/ - Technology

Thread replies: 16
Thread images: 2
File: RandomBitmap.png (44 KB, 220x220) Image search: [Google]
RandomBitmap.png
44 KB, 220x220
Is it just me or does the shuffle (or str_shuffle) function in PHP suck?

Here's what I'm trying to do:
>I download lots of porn pics of different genres from 4chan and other porn websites.
>I browse them one by one when I fap, sorting them by filename.
>I do not like when the same genre appears multiple times in a row.

I made a small PHP (*) script to generate random strings and rename all files, hoping to mix it up that way. But I'm never satisfied with it, I always find the same genre twice in a row, or not far enough. I don't know how much of that is actual randomness or bad algorithm.

Besides generating random strings, I also shuffle both the array of files and array of strings, trying to mix them up even more. But it doesn't seem to do it.

Maybe I don't have enough pictures to offer enough space between genres. Maybe I'm too picky and should think of another sorting way not based on randomness.

Thoughts?

(*) PHP is the only language I've learned so far. Newbie here. But I'd be glad to hear your language suggestion for that kind of scripts.
>>
Your problem is not one to be solved with rng. Map coloring algorithms might be a good place to start
>>
>>53864918
I have no idea what that is.
>>
>>53864451
why don't you get an image viewer that can shuffle the images?
>>
File: 1459695921212.png (746 KB, 949x661) Image search: [Google]
1459695921212.png
746 KB, 949x661
>>53864451
>4chan and other porn websites.
You, i like you.
>>
create a neural network that classifies all of your loli porn and have it compare two images (current and then one next) to see if they're the same, if not choose a different one
>>
>is it just me or PHP sucks?
Fixed the question for you and while we're at it, no, it's not just you.
>>
>>53865534
Tag each image with a category, then design an algorithm to create a random map of images such that no two categories touch in list.
>>
look for similarities in images and then assign those certain strings, and make sure they never touch
>>
>>53865652
>>53865680
I think the pictures are too different and too complex for that kind of comparison. Remember it's the same genre, but not necessarily the same picset.

>>53865664
Yeah, I thought about that. But tagging would be too much work.
My current script is probably imperfect, but at least, it's fast. I just download the images in mass, then click one button. I'm too horny to tag hundred of pictures.

Maybe beside generating random strings and shuffle everything, I could also compare creation date of two following pictures. If both were created around the same time (I download using a 'Save Images from Tabs' plugin), then I switch them or something.

But my original question was about shuffling. Because I tried looping the process more than once, hoping to mix them even more. 10000 shuffling should provide more randomness, right? But it doesn't seem to work. Almost as if the shuffle function is not random.

But maybe this is just me and everything is fine, and I just notice when two pics of the same genre are following.
>>
Do you guys want to have a laugh and take a look at the overkill algorithm I made?

1- I generate 4 random & shuffled strings of digits using openssl_random_pseudo_bytes that I concatenate, then re-shuffle.
2- I generate a SHA-512 hash of a md5 hash of a sha1 hash of the multiplication between the current time and a random number between 1 and 99999 using mt_rand. I shuffle the SHA-512 hash.
3- I generate a random string of chars from the alphabet and 3 special chars. That I shuffle, of course.
4- I concatenate the three previous strings and shuffle the new string.
>Turns out there were too much digits in the string to my taste, so I end up concatenating only the hash and the string of chars (twice).
5- I randomly cut the random string to get a desired length (40 chars).
6- I re-do the process as long as the random string begins with the same char than the 12 previous strings. When it passes, I add it to an array.
7- I do this until I have 1000 random strings. Then I shuffle the array.
8- I randomly choose the needed amount of strings in the array to rename all the files.
9- I shuffle the array of files 500 times. Then I rename them with the new array of strings.

>btw I made a function that loops the shuffling. Everytime I wrote I shuffled something, it actually got shuffled 5 times each time.

kek. This is how desperate I am to mix things up.
>>
Just kill yourself, desu.
>>
>>53866646
N-n-n-never.
>>
>>53864451
>don't know how much of that is actual randomness

pretty sure you can expect that to happen unless you have thousands of genres
>>
OP, read this:

https://labs.spotify.com/2014/02/28/how-to-shuffle-songs/
>>
>>53866930
Interesting read, thank you!
Thread replies: 16
Thread images: 2

banner
banner
[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y] [Home]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.