jQuery "array" is returned undefined
<p>Namaste!</p>

<p>My simple issue is that $sortedData becomes undefined in the following code upon execution:</p>

<pre><code>(function($) {
              $.fn.shuffle = function (){
                  var i = this.length, j, temp;
                  if ( i == 0 ) { return; }
                  while ( --i ) {
                      j = Math.floor( Math.random() * ( i + 1 ) );
                      temp = this[i];
                      this[i] = this[j];
                      this[j] = temp;
                  }
              };
            })(jQuery);

// DOMContentLoaded
            $(function() {
              // get the first collection
              var $cards = $('#cards');
              // clone cards to get a second collection
              var $data = $cards.clone();
              // call Quicksand when button clicked
              $('#shuffle').click(function(e) {
                // get all the list items
                var $filteredData = $data.find('li');
                // random sort (shuffling)
                var $sortedData = $filteredData.shuffle();
                // finally, call quicksand
                $cards.quicksand($sortedData, {
                  duration: 600,
                  easing: 'easeInOutQuad'
                });
              });

            });
</code></pre>

<p>How this is called:  I have a button that, when clicked, executes the above code.</p>

<p>I've checked the values in the shuffle function, and prior to the call to the shuffle function, but, when the shuffle function returns, $sortedData is undefined.</p>

<p>The error is probably a noobish one, but, I can't see it.</p>

<p>Thank you for your input!</p>
