<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Sequence shuffling revisited</title>
	<atom:link href="http://blog.viridian-project.de/2008/04/06/sequence-shuffling-revisited/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.viridian-project.de/2008/04/06/sequence-shuffling-revisited/</link>
	<description>Leslie P. Polzer on code, music, literature, design and free software business.</description>
	<lastBuildDate>Fri, 09 Dec 2011 14:52:23 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
	<item>
		<title>By: Christophe Rhodes</title>
		<link>http://blog.viridian-project.de/2008/04/06/sequence-shuffling-revisited/comment-page-1/#comment-1302</link>
		<dc:creator>Christophe Rhodes</dc:creator>
		<pubDate>Sun, 06 Apr 2008 17:44:04 +0000</pubDate>
		<guid isPermaLink="false">http://blog.viridian-project.de/?p=64#comment-1302</guid>
		<description>It&#039;s not a problem with literals; it&#039;s a problem with duplicate entries.

What I imagine &quot;foo&quot; is referring to is that your function isn&#039;t thread-safe, because the binding for seqrnd is shared amongst all threads.  (seqrnd is also not re-entrant: if you end up in the debugger, for example, and call seqrnd from there, you will destroy the current execution&#039;s state.)

To fix these problems, use one of the correct solutions that you are &quot;allergic&quot; to.</description>
		<content:encoded><![CDATA[<p>It&#8217;s not a problem with literals; it&#8217;s a problem with duplicate entries.</p>
<p>What I imagine &#8220;foo&#8221; is referring to is that your function isn&#8217;t thread-safe, because the binding for seqrnd is shared amongst all threads.  (seqrnd is also not re-entrant: if you end up in the debugger, for example, and call seqrnd from there, you will destroy the current execution&#8217;s state.)</p>
<p>To fix these problems, use one of the correct solutions that you are &#8220;allergic&#8221; to.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Leslie</title>
		<link>http://blog.viridian-project.de/2008/04/06/sequence-shuffling-revisited/comment-page-1/#comment-1301</link>
		<dc:creator>Leslie</dc:creator>
		<pubDate>Sun, 06 Apr 2008 15:28:29 +0000</pubDate>
		<guid isPermaLink="false">http://blog.viridian-project.de/?p=64#comment-1301</guid>
		<description>foo: what are you referring to?</description>
		<content:encoded><![CDATA[<p>foo: what are you referring to?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: foo</title>
		<link>http://blog.viridian-project.de/2008/04/06/sequence-shuffling-revisited/comment-page-1/#comment-1300</link>
		<dc:creator>foo</dc:creator>
		<pubDate>Sun, 06 Apr 2008 15:18:35 +0000</pubDate>
		<guid isPermaLink="false">http://blog.viridian-project.de/?p=64#comment-1300</guid>
		<description>Don&#039;t set the global variable. Use LET to bind a value to it.</description>
		<content:encoded><![CDATA[<p>Don&#8217;t set the global variable. Use LET to bind a value to it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Leslie</title>
		<link>http://blog.viridian-project.de/2008/04/06/sequence-shuffling-revisited/comment-page-1/#comment-1294</link>
		<dc:creator>Leslie</dc:creator>
		<pubDate>Sun, 06 Apr 2008 13:43:45 +0000</pubDate>
		<guid isPermaLink="false">http://blog.viridian-project.de/?p=64#comment-1294</guid>
		<description>Christophe: I can&#039;t think of a way to fix the problem with literals. Do you?

It would be really nice to do this with memoizing.
But having it working except for literals is already a nice thing.</description>
		<content:encoded><![CDATA[<p>Christophe: I can&#8217;t think of a way to fix the problem with literals. Do you?</p>
<p>It would be really nice to do this with memoizing.<br />
But having it working except for literals is already a nice thing.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Leslie</title>
		<link>http://blog.viridian-project.de/2008/04/06/sequence-shuffling-revisited/comment-page-1/#comment-1293</link>
		<dc:creator>Leslie</dc:creator>
		<pubDate>Sun, 06 Apr 2008 12:43:48 +0000</pubDate>
		<guid isPermaLink="false">http://blog.viridian-project.de/?p=64#comment-1293</guid>
		<description>Use &lt;pre lang=&quot;lisp&quot;&gt;CODE&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>Use &lt;pre lang=&#8221;lisp&#8221;&gt;CODE&lt;/pre&gt;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Phil Bewig</title>
		<link>http://blog.viridian-project.de/2008/04/06/sequence-shuffling-revisited/comment-page-1/#comment-1292</link>
		<dc:creator>Phil Bewig</dc:creator>
		<pubDate>Sun, 06 Apr 2008 12:29:19 +0000</pubDate>
		<guid isPermaLink="false">http://blog.viridian-project.de/?p=64#comment-1292</guid>
		<description>What&#039;s the trick to make the code indent properly?</description>
		<content:encoded><![CDATA[<p>What&#8217;s the trick to make the code indent properly?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Phil Bewig</title>
		<link>http://blog.viridian-project.de/2008/04/06/sequence-shuffling-revisited/comment-page-1/#comment-1291</link>
		<dc:creator>Phil Bewig</dc:creator>
		<pubDate>Sun, 06 Apr 2008 12:27:52 +0000</pubDate>
		<guid isPermaLink="false">http://blog.viridian-project.de/?p=64#comment-1291</guid>
		<description>I raised the question of how to shuffle a list in comp.lang.scheme in May 2002.  The imperative solution that I posted in response to your previous blog entry follows Knuth&#039;s method for shuffling a vector, and is O(n).  Any method involving sorting will be O(n log n), but for practical purposes the constant factors will probably defeat the asymptotic bounds.  The most functional-looking shuffle came from Joe Marshall; it partitions the list into two pieces deterministically, shuffles them recursively, then merges them back together randomly:

&lt;pre lang=&quot;lisp&quot;&gt;
(define (shuffle xs)
  (if (or (null? xs) (null? (cdr xs))) xs
      (let split ((xs xs) (odd &#039;()) (even &#039;()))
        (if (pair? xs)
            (split (cdr xs) (cons (car xs) even) odd)
            (let merge ((odd (shuffle odd)) (even (shuffle even)))
              (cond ((null? odd) even)
                    ((null? even) odd)
                    ((zero? (random 2)) (cons (car odd) (merge (cdr odd) even)))
                    (else (cons (car even) (merge odd (cdr even))))))))))
&lt;/pre&gt;

A faster functional shuffle comes from Al Petrofsky; it first partitions the list randomly, then merges the two pieces back together randomly:

&lt;pre lang=&quot;lisp&quot;&gt;
(define (shuffle xs)
  (let shuffle ((xs xs) (acc &#039;()))
    (if (null? xs) acc
        (if (null? (cdr xs)) (cons (car xs) acc)
            (let split ((xs xs) (x1 &#039;()) (x2 &#039;()))
              (if (null? xs)
                  (if (null? x1)
                      (split x2 &#039;() &#039;())
                      (shuffle x1 (shuffle x2 acc)))
                  (if (zero? (random 2))
                      (split (cdr xs) (cons (car xs) x1) x2)
                      (split (cdr xs) x1 (cons (car xs) x2)))))))))
&lt;/pre&gt;

If you speak Haskell, Oleg Kiselyov presented a perfect shuffle of complexity O(n log n) in comp.lang.functional in September 2001.  I won&#039;t quote it here, because the implementation only makes sense if you read the accompanying derivation.</description>
		<content:encoded><![CDATA[<p>I raised the question of how to shuffle a list in comp.lang.scheme in May 2002.  The imperative solution that I posted in response to your previous blog entry follows Knuth&#8217;s method for shuffling a vector, and is O(n).  Any method involving sorting will be O(n log n), but for practical purposes the constant factors will probably defeat the asymptotic bounds.  The most functional-looking shuffle came from Joe Marshall; it partitions the list into two pieces deterministically, shuffles them recursively, then merges them back together randomly:</p>

<div class="wp_syntax"><div class="code"><pre class="lisp" style="font-family:monospace;"><span style="color: #66cc66;">&#40;</span>define <span style="color: #66cc66;">&#40;</span>shuffle xs<span style="color: #66cc66;">&#41;</span>
  <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">or</span> <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">null</span>? xs<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">null</span>? <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">cdr</span> xs<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> xs
      <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">let</span> split <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>xs xs<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#40;</span>odd '<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#40;</span>even '<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
        <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>pair? xs<span style="color: #66cc66;">&#41;</span>
            <span style="color: #66cc66;">&#40;</span>split <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">cdr</span> xs<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">cons</span> <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">car</span> xs<span style="color: #66cc66;">&#41;</span> even<span style="color: #66cc66;">&#41;</span> odd<span style="color: #66cc66;">&#41;</span>
            <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">let</span> merge <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>odd <span style="color: #66cc66;">&#40;</span>shuffle odd<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#40;</span>even <span style="color: #66cc66;">&#40;</span>shuffle even<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
              <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">cond</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">null</span>? odd<span style="color: #66cc66;">&#41;</span> even<span style="color: #66cc66;">&#41;</span>
                    <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">null</span>? even<span style="color: #66cc66;">&#41;</span> odd<span style="color: #66cc66;">&#41;</span>
                    <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>zero? <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">random</span> <span style="color: #cc66cc;">2</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">cons</span> <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">car</span> odd<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#40;</span>merge <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">cdr</span> odd<span style="color: #66cc66;">&#41;</span> even<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
                    <span style="color: #66cc66;">&#40;</span>else <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">cons</span> <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">car</span> even<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#40;</span>merge odd <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">cdr</span> even<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span></pre></div></div>

<p>A faster functional shuffle comes from Al Petrofsky; it first partitions the list randomly, then merges the two pieces back together randomly:</p>

<div class="wp_syntax"><div class="code"><pre class="lisp" style="font-family:monospace;"><span style="color: #66cc66;">&#40;</span>define <span style="color: #66cc66;">&#40;</span>shuffle xs<span style="color: #66cc66;">&#41;</span>
  <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">let</span> shuffle <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>xs xs<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#40;</span>acc '<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
    <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">null</span>? xs<span style="color: #66cc66;">&#41;</span> acc
        <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">null</span>? <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">cdr</span> xs<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">cons</span> <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">car</span> xs<span style="color: #66cc66;">&#41;</span> acc<span style="color: #66cc66;">&#41;</span>
            <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">let</span> split <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>xs xs<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#40;</span>x1 '<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#40;</span>x2 '<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
              <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">null</span>? xs<span style="color: #66cc66;">&#41;</span>
                  <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">null</span>? x1<span style="color: #66cc66;">&#41;</span>
                      <span style="color: #66cc66;">&#40;</span>split x2 '<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> '<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
                      <span style="color: #66cc66;">&#40;</span>shuffle x1 <span style="color: #66cc66;">&#40;</span>shuffle x2 acc<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
                  <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>zero? <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">random</span> <span style="color: #cc66cc;">2</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
                      <span style="color: #66cc66;">&#40;</span>split <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">cdr</span> xs<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">cons</span> <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">car</span> xs<span style="color: #66cc66;">&#41;</span> x1<span style="color: #66cc66;">&#41;</span> x2<span style="color: #66cc66;">&#41;</span>
                      <span style="color: #66cc66;">&#40;</span>split <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">cdr</span> xs<span style="color: #66cc66;">&#41;</span> x1 <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">cons</span> <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">car</span> xs<span style="color: #66cc66;">&#41;</span> x2<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span></pre></div></div>

<p>If you speak Haskell, Oleg Kiselyov presented a perfect shuffle of complexity O(n log n) in comp.lang.functional in September 2001.  I won&#8217;t quote it here, because the implementation only makes sense if you read the accompanying derivation.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Leslie</title>
		<link>http://blog.viridian-project.de/2008/04/06/sequence-shuffling-revisited/comment-page-1/#comment-1290</link>
		<dc:creator>Leslie</dc:creator>
		<pubDate>Sun, 06 Apr 2008 11:40:47 +0000</pubDate>
		<guid isPermaLink="false">http://blog.viridian-project.de/?p=64#comment-1290</guid>
		<description>Here are the results, comparing Paul Khuong&#039;s RANDOM-SHUFFLE with SEQRND.

&lt;pre lang=&quot;lisp&quot;&gt;
(defun benchmark (fn)
 (dotimes (x 1000)
   (let ((seq (loop for i from 1 to 1000 collect (random i))))
     (funcall fn seq))))

(time (benchmark #&#039;random-shuffle))
(time (benchmark #&#039;seqrnd))
&lt;/pre&gt;
&lt;hr /&gt;
&lt;pre&gt;
CLISP 2.41 (interpreted):

Real time: 25.72314 sec.
Run time: 10.665971 sec.
Space: 86264000 Bytes
GC: 164, GC time: 0.669959 sec.

Real time: 72.53122 sec.
Run time: 29.028109 sec.
Space: 79356432 Bytes
GC: 152, GC time: 0.5233 sec.

Bottom line: RANDOM-SHUFFLE 3x faster, SEQRND slightly less space.
&lt;/pre&gt;
&lt;hr /&gt;
&lt;pre&gt;
CLISP 2.41 (compiled)

Real time: 19.819485 sec.
Run time: 8.232797 sec.
Space: 86016072 Bytes
GC: 164, GC time: 0.663291 sec.

Real time: 28.287846 sec.
Run time: 10.196001 sec.
Space: 79108984 Bytes
GC: 151, GC time: 0.519969 sec.

Bottom line: RANDOM-SHUFFLE 1.35x faster, SEQRND slightly less space.
&lt;/pre&gt;
&lt;hr /&gt;
&lt;pre&gt;
SBCL 1.0.15:

Evaluation took:
  13.861 seconds of real time
  5.013006 seconds of user run time
  0.126658 seconds of system run time
  [Run times include 0.074 seconds GC run time.]
  0 calls to %EVAL
  0 page faults and
  52,039,552 bytes consed.

Evaluation took:
  4.639 seconds of real time
  2.263186 seconds of user run time
  0.026665 seconds of system run time
  [Run times include 0.009 seconds GC run time.]
  0 calls to %EVAL
  0 page faults and
  30,302,776 bytes consed.

Bottom line: SEQRND 3x faster, SEQRND 3/5 space.
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>Here are the results, comparing Paul Khuong&#8217;s RANDOM-SHUFFLE with SEQRND.</p>

<div class="wp_syntax"><div class="code"><pre class="lisp" style="font-family:monospace;"><span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">defun</span> benchmark <span style="color: #66cc66;">&#40;</span>fn<span style="color: #66cc66;">&#41;</span>
 <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">dotimes</span> <span style="color: #66cc66;">&#40;</span>x <span style="color: #cc66cc;">1000</span><span style="color: #66cc66;">&#41;</span>
   <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">let</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>seq <span style="color: #66cc66;">&#40;</span>loop for i from <span style="color: #cc66cc;">1</span> to <span style="color: #cc66cc;">1000</span> collect <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">random</span> i<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
     <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">funcall</span> fn seq<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
&nbsp;
<span style="color: #66cc66;">&#40;</span>time <span style="color: #66cc66;">&#40;</span>benchmark #'random-shuffle<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#40;</span>time <span style="color: #66cc66;">&#40;</span>benchmark #'seqrnd<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span></pre></div></div>

<hr />
<pre>
CLISP 2.41 (interpreted):

Real time: 25.72314 sec.
Run time: 10.665971 sec.
Space: 86264000 Bytes
GC: 164, GC time: 0.669959 sec.

Real time: 72.53122 sec.
Run time: 29.028109 sec.
Space: 79356432 Bytes
GC: 152, GC time: 0.5233 sec.

Bottom line: RANDOM-SHUFFLE 3x faster, SEQRND slightly less space.
</pre>
<hr />
<pre>
CLISP 2.41 (compiled)

Real time: 19.819485 sec.
Run time: 8.232797 sec.
Space: 86016072 Bytes
GC: 164, GC time: 0.663291 sec.

Real time: 28.287846 sec.
Run time: 10.196001 sec.
Space: 79108984 Bytes
GC: 151, GC time: 0.519969 sec.

Bottom line: RANDOM-SHUFFLE 1.35x faster, SEQRND slightly less space.
</pre>
<hr />
<pre>
SBCL 1.0.15:

Evaluation took:
  13.861 seconds of real time
  5.013006 seconds of user run time
  0.126658 seconds of system run time
  [Run times include 0.074 seconds GC run time.]
  0 calls to %EVAL
  0 page faults and
  52,039,552 bytes consed.

Evaluation took:
  4.639 seconds of real time
  2.263186 seconds of user run time
  0.026665 seconds of system run time
  [Run times include 0.009 seconds GC run time.]
  0 calls to %EVAL
  0 page faults and
  30,302,776 bytes consed.

Bottom line: SEQRND 3x faster, SEQRND 3/5 space.
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Christophe Rhodes</title>
		<link>http://blog.viridian-project.de/2008/04/06/sequence-shuffling-revisited/comment-page-1/#comment-1289</link>
		<dc:creator>Christophe Rhodes</dc:creator>
		<pubDate>Sun, 06 Apr 2008 11:37:23 +0000</pubDate>
		<guid isPermaLink="false">http://blog.viridian-project.de/?p=64#comment-1289</guid>
		<description>No, an EQ hash table does not fix your problem.

Test cases:

(seqrnd (list 1 1 1 2 3))

(let ((x &quot;foo&quot;))
  (seqrnd (list x x x 3 x)))</description>
		<content:encoded><![CDATA[<p>No, an EQ hash table does not fix your problem.</p>
<p>Test cases:</p>
<p>(seqrnd (list 1 1 1 2 3))</p>
<p>(let ((x &#8220;foo&#8221;))<br />
  (seqrnd (list x x x 3 x)))</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Leslie</title>
		<link>http://blog.viridian-project.de/2008/04/06/sequence-shuffling-revisited/comment-page-1/#comment-1288</link>
		<dc:creator>Leslie</dc:creator>
		<pubDate>Sun, 06 Apr 2008 11:05:49 +0000</pubDate>
		<guid isPermaLink="false">http://blog.viridian-project.de/?p=64#comment-1288</guid>
		<description>Christophe: indeed, it should be an EQ hash table. Fixed.

I didn&#039;t benchmark the consing (yet), but I&#039;m positive the hash table will be faster; I&#039;ll check this later.</description>
		<content:encoded><![CDATA[<p>Christophe: indeed, it should be an EQ hash table. Fixed.</p>
<p>I didn&#8217;t benchmark the consing (yet), but I&#8217;m positive the hash table will be faster; I&#8217;ll check this later.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

