<!-- 
RSS generated by JIRA (4.4#649-r158309) at Fri May 24 05:13:23 CDT 2013

It is possible to restrict the fields that are returned in this document by specifying the 'field' parameter in your request.
For example, to request only the issue key and summary add field=key&field=summary to the URL of your request.
For example:
http://dev.clojure.org/jira/si/jira.issueviews:issue-xml/TGEN-1/TGEN-1.xml?field=key&field=summary
-->
<rss version="0.92" >
<channel>
    <title>Clojure JIRA</title>
    <link>http://dev.clojure.org/jira</link>
    <description>This file is an XML representation of an issue</description>
    <language>en-us</language>    <build-info>
        <version>4.4</version>
        <build-number>649</build-number>
        <build-date>25-07-2011</build-date>
    </build-info>

<item>
            <title>[TGEN-1] generators/shuffle violates contract of Comparable</title>
                <link>http://dev.clojure.org/jira/browse/TGEN-1</link>
                <project id="10081" key="TGEN">test.generative</project>
                        <description>&lt;p&gt;JDK 7&apos;s sort function is stricter about verifying that implementations of the comparison function actually obey their contract. It will even helpfully throw an exception when this is not the case:&lt;/p&gt;

&lt;p&gt;&lt;tt&gt;java.lang.IllegalArgumentException: Comparison method violates its general contract!&lt;/tt&gt;&lt;/p&gt;

&lt;p&gt;The root cause is this gem:&lt;/p&gt;

&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeHeader panelHeader&quot; style=&quot;border-bottom-width: 1px;&quot;&gt;&lt;b&gt;generators.clj&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;(defn shuffle
      &lt;span class=&quot;code-quote&quot;&gt;&quot;Shuffle coll&quot;&lt;/span&gt;
      [coll]
      (sort-by (fn [_] (&lt;span class=&quot;code-object&quot;&gt;long&lt;/span&gt;)) coll))&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Which does not work on JDK7 since TimSort is clever enough to detect that the ordering function is behaving inconsistently, resulting in the previously mentioned exception.&lt;/p&gt;

&lt;p&gt;Also, this is just a bad idea:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;A variant of the above method that has seen some use in languages that support sorting with user-specified comparison functions is to shuffle a list by sorting it with a comparison function that returns random values. However, this is an extremely bad method: it is very likely to produce highly non-uniform distributions, which in addition depends heavily on the sorting algorithm used.&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;(&lt;a href=&quot;http://en.wikipedia.org/wiki/Fisher-Yates_shuffle#Comparison_with_other_shuffling_algorithms&quot;&gt;wikipedia&lt;/a&gt;)&lt;/p&gt;
</description>
                <environment>Mac OS X 10.8.2&lt;br/&gt;
java version &amp;quot;1.7.0_06&amp;quot;&lt;br/&gt;
Java(TM) SE Runtime Environment (build 1.7.0_06-b24)&lt;br/&gt;
Java HotSpot(TM) 64-Bit Server VM (build 23.2-b09, mixed mode)&lt;br/&gt;
</environment>
            <key id="15749">TGEN-1</key>
            <summary>generators/shuffle violates contract of Comparable</summary>
                <type id="1" iconUrl="http://dev.clojure.org/jira/images/icons/bug.gif">Defect</type>
                                <priority id="3" iconUrl="http://dev.clojure.org/jira/images/icons/priority_major.gif">Major</priority>
                    <status id="5" iconUrl="http://dev.clojure.org/jira/images/icons/status_resolved.gif">Resolved</status>
                    <resolution id="1">Completed</resolution>
                                <assignee username="bsmith.occs@gmail.com">Ben Smith-Mannschott</assignee>
                                <reporter username="bsmith.occs@gmail.com">Ben Smith-Mannschott</reporter>
                        <labels>
                    </labels>
                <created>Sat, 13 Oct 2012 03:11:45 -0500</created>
                <updated>Sun, 14 Oct 2012 11:13:39 -0500</updated>
                    <resolved>Sun, 14 Oct 2012 11:13:39 -0500</resolved>
                                                                    <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                        <comments>
                    <comment id="29647" author="bsmith.occs@gmail.com" created="Sun, 14 Oct 2012 11:13:39 -0500"  >&lt;p&gt;Fixed by &lt;a href=&quot;https://github.com/clojure/test.generative/commit/5a59bf0fcddde12397d575e40aea3487f1f61825&quot;&gt;5a59bf0f&lt;/a&gt; on &lt;a href=&quot;https://github.com/clojure/test.generative&quot;&gt;test.generative&lt;/a&gt;.&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                    <attachment id="11558" name="fisher-yates-shuffle.diff" size="2634" author="bsmith.occs@gmail.com" created="Sat, 13 Oct 2012 03:20:42 -0500" />
                </attachments>
            <subtasks>
        </subtasks>
                <customfields>
                                <customfield id="customfield_10002" key="com.atlassian.jira.plugin.system.customfieldtypes:select">
                <customfieldname>Approval</customfieldname>
                <customfieldvalues>
                        <customfieldvalue key="10005">Accepted</customfieldvalue>

                </customfieldvalues>
            </customfield>
                                                                                    <customfield id="customfield_10010" key="com.pyxis.greenhopper.jira:gh-global-rank">
                <customfieldname>Global Rank</customfieldname>
                <customfieldvalues>
                    
                </customfieldvalues>
            </customfield>
                                            <customfield id="customfield_10000" key="com.atlassian.jira.plugin.system.customfieldtypes:select">
                <customfieldname>Patch</customfieldname>
                <customfieldvalues>
                        <customfieldvalue key="10001">Code</customfieldvalue>

                </customfieldvalues>
            </customfield>
                                                                                        </customfields>
    </item>
</channel>
</rss>