Twitter | Search | |
@rem
Question/riddle (read: IDK): I'm making 5 requests to an image service using cache busting to get a random image. If any URLs are duplicated, I replace them with new request for a random image. Does this: a) Increase chance of unique images b) No difference c) Lessen chances
Reply Retweet Like More
Marcus Blättermann 🍃 Jun 9
Replying to @rem
Are the request to the same URL, but that URL returns a random image or are they to a random URL, where the sameURL always returns the same image and you add cache busting?
Reply Retweet Like
Fernando Montoya Jun 9
Replying to @rem
You are playing with Universe dices
Reply Retweet Like
@rem Jun 9
Replying to @essenmitsosse
The first thing
Reply Retweet Like
Marcus Blättermann 🍃 Jun 9
Replying to @rem
Then how is 'if any urls are duplicated' a condition? shouldn't all urls be duplicated?
Reply Retweet Like
@rem Jun 9
Replying to @essenmitsosse
Oh, sorry, the URL redirects to different images
Reply Retweet Like
Marcus Blättermann 🍃 Jun 9
Replying to @rem
Ok. Now I am confused. 😅
Reply Retweet Like
Marcus Blättermann 🍃 Jun 9
Replying to @rem
Does the url redirect to a random (but static url) for an individual image? Am I getting this right?
Reply Retweet Like
@rem Jun 9
Replying to @essenmitsosse
It's with cache busting
Reply Retweet Like
Marcus Blättermann 🍃 Jun 9
Replying to @rem
If I get this right: since you only retry to get a new image when it was already a duplicate, and there is a non-zero chance to get an image that is not already in your set, it should improve the chance of getting a unique image.
Reply Retweet Like
Marcus Blättermann 🍃 Jun 9
Replying to @rem
Edge case would be if the amount of images you request would be equal or less then the amount of available images.
Reply Retweet Like
Marcus Blättermann 🍃 Jun 9
Replying to @rem
The service you use seems to be odd as in there is a very high chance to get the same image multiple times if you request them in a very small time frame.
Reply Retweet Like
Brad Frost Jun 9
Replying to @rem
Just letting you know that if I ever see a poll with a shrug option, I'm hitting that thing HARD.
Reply Retweet Like
jon snowder Jun 9
Replying to @essenmitsosse @rem
Yeah if it’s the same url and you’re using cache headers as intended and you haven’t discovered all of them - was my reasoning for picking increase
Reply Retweet Like
Ruben Schulz Jun 9
Replying to @rem
Does the image service have more than 5 images? :P Then a)
Reply Retweet Like
Ankit Aggarwal Jun 9
Replying to @rubenschulz @rem
Agreed. The chance you get an image url = one of the other four you have lowers each time you request that fifth image. Probability is 1-(m/n)^r, where m = # images you’ve already got (i.e. 4), n = total # of images, r = # of requests you make
Reply Retweet Like
@rem Jun 10
Replying to @brad_frost
You're in good company it would seem (myself included)
Reply Retweet Like
Jake Archibald Jun 10
Replying to @rem
If something has a less-than-certain chance of happening, the chance of it happening twice in a row is always less than the chance of it happening once.
Reply Retweet Like
Max Waterman Jun 10
Replying to @jaffathecake @rem
Then is it random? I thought random meant equal chance.
Reply Retweet Like
Jake Archibald Jun 10
Replying to @davidmaxwaterma @rem
Equal chance to what? If the roll of a dice is random, then the chance of a 3 is 1/6. The chance of getting two 3s in a row is 1/6 * 1/6, or 1/12.
Reply Retweet Like