worksheet for lab #13 --------------------- a) read the nature article on randomizing the deck, "shuffling: what's the deal?" b) quickly read the other web article, make note of the gray box describing the GSR shuffling algorithm. c) download the .m files for this week. - - - - - - - - - - - idea ---- studies seem to indicate that 5-7 GSR shuffles are required to randomize a 52-card deck. but can one recognize a particular random deck? no. after all, even 9-1-1 was NY state's random winning number on 11 sept 2002. but one might hope to show that some statistic of shuffled decks matches the same statistic for purely random decks. understand this --------------- "w13random.m" deals 800 random 52-card decks. "perfect" is the vector ordered cards 1:52. "deck" is a vector of the numbers 1-52 in a purely random order. a mean-square statistic is calculated which is: data = sum( (a_j - j)^2 ) / 52 that is, the mean-squared difference between the random cards & their perfectly ordered location. i will show in class tomorrow that the average of this mean-square statistic is: theoretical mean = (Ncards^2 - 1) / 6 = 450.5 (52-cards) the graph shows the EDF of this mean-square statistic for the 800 deals. this .m script has two useful code snippets: the mean-square statistic loop and an EDF plotter. be sure you understand what this code does. - - - - - - - - - - - - - - - - coding exercise --------------- deal 800 decks using GSR shuffling technique. i have written a function "shuffle" which returns a new random GSR permutation matrix every time it is called. try "Pn = shuffle(10);". then "full(Pn)" will show the result, and "spy(Pn)" will make the sparsity plot like in the class demo. produce a 8x800 array which stores mean-square data as 800 deals are made by shuffling a perfectly-ordered deck with 8 GSR shuffles. the pseudocode for the loop looks something like: for k=1:Ndeals reset deck to perfect for j=1:Nshuffles shuffle once calculate mean-square stat end end plot the EDFs which show how the stats become more like the random case as the number of shuffles increases. remember, the EDF for a perfectly random deck should be like the curve of "w13random".