<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p><br>
</p>
<div class="moz-cite-prefix">On 11/8/2021 5:06 PM, Ray Dillinger
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:9c46b430-3481-6b96-995e-feed217359fb@sonic.net">
<pre class="moz-quote-pre" wrap="">
On 11/8/21 11:31 PM, Christian Huitema wrote:
</pre>
<blockquote type="cite" style="color: #007cff;">
<pre class="moz-quote-pre" wrap="">On 11/8/2021 1:00 PM, Ray Dillinger wrote:
</pre>
<blockquote type="cite" style="color: #007cff;">
<pre class="moz-quote-pre" wrap="">But if you do 52 perfect shuffles in a row you bring the deck back into
its original order. No matter what (n) you use, it will never be 'more
secure' than some (n) less than 52. The so-called 'perfect shuffle' is
actually fairly lousy considered as a randomization algorithm, but you
see the point.
</pre>
</blockquote>
<pre class="moz-quote-pre" wrap="">Really? Did you mean to write 52! perfect shuffles in a row?
</pre>
</blockquote>
<pre class="moz-quote-pre" wrap="">Nope. It's only 52. Closed cycles of a single operation within a group
tend to be very short on average. 52! is absolutely the longest a state
cycle could be, 52 is "typical" for most repeated operations.
No need to take my word for it though: Try it yourself! I'm just
eyeballing this but I bet it'll compile:
int main(int argc, char **argv){
int deck1[52]; int deck2[52]; int count; int shuffle;
for (count = 0;count<52;count++)deck1[count]=count;
for (shuffle=count=0; shuffle<52; shuffle+=(++count==52),count=count%52)
(shuffle%2?deck1:deck2)[count]=(shuffle%2?deck2:deck1)[count/2+count%2?0:26];
for (int count = 0; count<52;count++) if (deck1[count]!=count) break;
printf(count==52?"succeeded.\n":"failed.\n");
}</pre>
</blockquote>
<p>Sorry, my laziness for not looking up "perfect shuffle" as a term
of the art. I quick-read that as "perfectly random shuffles", and
that is indeed not what a "perfect shuffle" is. And indeed,
repeating a perfect shuffle 52 times is very much like repeating
rot13 twice.</p>
<p>-- Christian Huitema<br>
</p>
</body>
</html>