Random Text Array + Fade on Interval + Shuffle
<p>I have an array of text that comes in over a set interval with a fade and is randomized (<a href="http://zbettendorf.com" rel="nofollow">see my website</a>). The problem being that I want the array to shuffle, so that none of the text repeats until all of the array has cycled through. I tried adding <code>textArray.shuffle();</code> directly after the array (among multiple other solutions), but so far the shuffle has either had no effect or kills the script entirely.</p>

<p>Here is the entirety of my script:</p>

<pre><code>$(document).ready( function() {
    var textArray = [
        'Hello! I\'m Zac. I\'m allergic to pineapples, gum, and woolly bear caterpillars. And Comic Sans.',
        'Hello! I\'m Zac. I love Apple products.',
        'Hello! I\'m Zac. I have touched the North, East, West, and South coasts of the USA.',
        'Hello! I\'m Zac. I\'m a designer.',
        'Hello! I\'m Zac. I lived in Minnesota for 20 years. I\'ve lived in Ohio for 2 and a half.',
        'Hello! I\'m Zac. Two of my favorite artists are Shepard Fairey and Banksy.',
        'Hello! I\'m Zac. Bettendorf (my last name) is also the name of one of the Quad Cities.',
        'Hello! I\'m Zac. My high school graduating class consisted of just 36 people.',
        'Hello! I\'m Zac. My closet is arranged by hue, saturation, and luminosity.',
        'Hello! I\'m Zac. I\'m a visual artist.',
        'Hello! I\'m Zac. I\'m a Minnesota native.',
        'Hello! I\'m Zac. The servers that host this website are 100% wind powered.'
        ];
    textArray.shuffle();

    $('#text-content').loadText( textArray, 6000 ); // ( array, interval )
});

// custom jquery plugin loadText()
$.fn.loadText = function( textArray, interval ) {
    return this.each( function() {
        var obj = $(this);
        obj.fadeOut( 'slow', function() {
            obj.empty().html( random_array( textArray ) );
            obj.fadeIn( 'slow' );
        });
        timeOut = setTimeout( function(){ obj.loadText( textArray, interval )}, interval );
        // reload random text (if not animated) -- entirely optional, can be removed, along with the reload link above (&lt;a href="javascript:;" id="text-reload"&gt;&lt;em&gt;randomize&lt;/em&gt;&lt;/a&gt;)
        $("#text-reload").click( function(){
            if( !obj.is(':animated') ) { clearTimeout( timeOut ); obj.loadText( textArray, interval );} // animation check prevents "too much recursion" error in jQuery
        });
    });
}
//public function
function random_array( aArray ) {
    var rand = Math.floor( Math.random() * aArray.length + aArray.length );
    var randArray = aArray[ rand - aArray.length ];
    return randArray;
}
</code></pre>
