Skip to main content
18 events
when toggle format what by license comment
Sep 8, 2014 at 21:43 history edited Bruno Costa CC BY-SA 3.0
updated code to fix bob floyd implementation and shuffle max value. None of the results changed.
Sep 8, 2014 at 8:31 comment added mjolka Let us continue this discussion in chat.
Sep 8, 2014 at 6:47 comment added mjolka The line T := RandInt(1, J) in the pseudocode picks a number in the range [1, J], not [1, J). Next's maxValue parameter is exclusive, so you need to either do if (!values.Add(random.Next(min, i + min + 1))) { values.Add(i + min); } or if (!values.Add(random.Next(min, i + min))) { values.Add(i + min - 1); }, depending on whether you're treating max as inclusive or exclusive.
Sep 8, 2014 at 6:12 comment added Bruno Costa @mjolka No it shouldn't.
Sep 8, 2014 at 0:21 comment added mjolka There's still a mistake in the Bob Floyd algorithm; values.Add(i+min) should be values.Add(i+min-1).
Sep 7, 2014 at 13:19 comment added Bruno Costa @mjolka thanks again. I updated my answer accordingly.
Sep 7, 2014 at 13:18 history edited Bruno Costa CC BY-SA 3.0
corrected algorithm to contemplate min != 0
Sep 7, 2014 at 8:43 comment added mjolka There are errors in your translation of Bob Floyd's algorithm; try Sequence.BobFloydNonRepeatingSequence(8, 14, 3, 7) -- it throws an ArgumentOutOfRangeException.
Sep 6, 2014 at 0:39 comment added Bruno Costa after a quick overview I noticed that I wasn't using a Random thread safely but despite of this my tests results didn't change.
Sep 6, 2014 at 0:16 history edited Bruno Costa CC BY-SA 3.0
added 5 characters in body
Sep 5, 2014 at 23:55 history edited Bruno Costa CC BY-SA 3.0
spell check
Sep 5, 2014 at 23:28 history edited Bruno Costa CC BY-SA 3.0
added 4897 characters in body
Sep 3, 2014 at 7:37 history edited Bruno Costa CC BY-SA 3.0
added 1011 characters in body
Sep 2, 2014 at 22:38 history edited Bruno Costa CC BY-SA 3.0
added 1 character in body
Sep 2, 2014 at 21:15 history edited Bruno Costa CC BY-SA 3.0
added 25 characters in body
Sep 2, 2014 at 20:50 history edited Bruno Costa CC BY-SA 3.0
added 12 characters in body
Sep 2, 2014 at 20:45 history edited Bruno Costa CC BY-SA 3.0
added 746 characters in body
Sep 2, 2014 at 20:39 history answered Bruno Costa CC BY-SA 3.0