Skip to main content

Timeline for Shuffle a subsequence

Current License: CC BY-SA 4.0

38 events
when toggle format what by license comment
Feb 19, 2023 at 20:00 answer added Shaggy timeline score: 0
Dec 30, 2021 at 0:43 comment added att In general, for a list of length \$l\$, the probability of a permutation that keeps \$d\$ points fixed should be \$\frac1{2^l-1}\sum_{i=1}^l\frac1{i!}{d \choose d-l+i}\$.
Dec 29, 2021 at 21:48 answer added Dominic van Essen timeline score: 3
Dec 29, 2021 at 21:00 history tweeted twitter.com/StackCodeGolf/status/1476296990778707968
Dec 29, 2021 at 19:55 answer added pajonk timeline score: 4
Dec 29, 2021 at 16:30 answer added Ajax1234 timeline score: 1
Dec 29, 2021 at 15:40 answer added ovs timeline score: 2
Dec 29, 2021 at 15:14 answer added rydwolf timeline score: 1
Dec 29, 2021 at 14:53 comment added thejonymyster @Razetime that's what I thought too, but if you look at tsh's distributions for input [1, 2, 3] you'll note that the probabilities are not all equal, as they'd be with a standard random shuffle of the entire input.
Dec 29, 2021 at 12:19 answer added Dominic van Essen timeline score: 3
Dec 29, 2021 at 12:06 answer added Noodle9 timeline score: 1
Dec 29, 2021 at 11:57 comment added Razetime so then it i s just simply a random shuffle, no?
Dec 29, 2021 at 10:12 answer added Graham timeline score: 2
Dec 29, 2021 at 9:41 comment added Dominic van Essen @Razetime - I doubt it, because that approach could never regenerate the original array, which should be one of the valid ouputs.
Dec 29, 2021 at 9:25 answer added Jayant Choudhary timeline score: 1
Dec 29, 2021 at 8:56 history became hot network question
Dec 29, 2021 at 8:29 comment added Razetime can't this be done by simply making a random shuffle not equal to the array?
Dec 29, 2021 at 8:22 answer added Neil timeline score: 3
Dec 29, 2021 at 7:12 answer added loopy walt timeline score: 3
Dec 29, 2021 at 5:24 comment added tsh To my understanding, output for [1, 2, 3] should be \$\frac{2}{3}\$ [1, 2, 3]; \$\frac{2}{21}\$ [2, 1, 3]; \$\frac{2}{21}\$ [1, 3, 2]; \$\frac{2}{21}\$ [3, 2, 1]; \$\frac{1}{42}\$ [3, 1, 2]; \$\frac{1}{42}\$ [2, 3, 1]. If I was calculated correctly... I would suggest answers show destribution of input [1, 2, 3] and confirm it meats the requirement of distribution.
Dec 29, 2021 at 3:59 answer added Kjetil S timeline score: 4
Dec 29, 2021 at 3:24 history edited hyperneutrino CC BY-SA 4.0
added 2 characters in body
Dec 29, 2021 at 3:20 comment added Jonathan Allan @emanresuA I believe that you are thinking of "substring", see this math post.
Dec 29, 2021 at 3:10 answer added Jonah timeline score: 5
Dec 29, 2021 at 2:29 comment added caird coinheringaahin g @pxeger As stated at the start of the challenge, "choose randomly" in this case means that a uniform distribution should be used, and every non-empty subsequence should have the same probability of being chosen. It doesn't have to compute the powerset (but I suspect that most will) so long as each is uniformly chosen
Dec 29, 2021 at 2:24 comment added pxeger I think you need to specify more exactly what "elect a randomly chosen, non-empty subsequence from the array" means, because there are multiple reasonable ways to do this with different distributions. Does it have to be equivalent to computing the input's powerset (without the empty list) and choosing one of those sets randomly?
Dec 29, 2021 at 2:07 comment added caird coinheringaahin g @tsh As to not invalidate the current answers, I think going by indices is a better choice
Dec 29, 2021 at 2:06 comment added tsh How should I choose sub-sequence? For input [2, 3, 4, 3, 4, 5], if we choose sub-sequence by their values, say [2, 3, 4, 5], then both [2, 3, 4, 4, 3, 5], [2, 3, 3, 4, 4, 5], [2, 4, 3, 3, 4, 5] may be a valid output. But if we choose by their indexes, say [0, 1, 2, 5], then only [2, 3, 4, 4, 3, 5] in above examples are still valid.
Dec 29, 2021 at 1:42 answer added att timeline score: 3
Dec 29, 2021 at 1:02 answer added lyxal timeline score: 3
Dec 29, 2021 at 1:02 comment added caird coinheringaahin g @ZaMoC Yes, there may be repeats
Dec 29, 2021 at 1:01 comment added ZaMoC Can the array have repeated digits?
Dec 29, 2021 at 1:00 answer added hyperneutrino timeline score: 6
Dec 29, 2021 at 0:59 comment added caird coinheringaahin g @U12-Forward No, the subsequence can be of any length between 1 and the length of the input. "a random non-empty subsequence" refers to choosing from all non-empty subsequences of the input
Dec 29, 2021 at 0:58 comment added U13-Forward Do the subsequences need to be length 3?
Dec 29, 2021 at 0:57 history edited caird coinheringaahin g CC BY-SA 4.0
added 4 characters in body
Dec 29, 2021 at 0:55 comment added emanresu A subsequence implies contiguous, you might want to specify that it's all subsets
Dec 29, 2021 at 0:54 history asked caird coinheringaahin g CC BY-SA 4.0