 So when is there a practical application for using this pass-by reference? Well, here's a good one when we think about something like shuffling maybe a deck of cards or some random numbers say for example again, I Built out some code where we look at this. I basically am saying create a new array of 100 integers and Just set them equal to 1 to 100 Okay, 1 to 100 right now. They're in order But let's jumble them up. Let's just put them all over the place. Well, what we can do is again because we're using pass-by a reference if I say shuffle nums What happens is that memory address gets passed to shuffle and becomes list and any direct manipulation I do to the elements is going to be Persistent so even though that this is a void data type even though it has no return Any changes I make to the array are going to be persistent So even though right now it is 1 to 100 in order as soon as I run through this You're gonna see that They no longer are and if I run through it again not compile it again, but run through it again And run through it again. I get a random Set of numbers I get a random order each and every time so one way you can think about it again Is maybe this is like a deck of cards instead of it being? 100 I'm playing 52 and instead of shuffling around, you know a card objects Because those those are complex I can shuffle around my kind of indices and now again This is a way for me to sort of have a Way to persistently know even though I'm randomly generating a number What's the next randomly generated number? What was the previously generated number? So I can go back and forth between my number So say for example instead of it being a deck of cards I'm thinking a playlist a music player for example I've got it on shuffle, but I really liked the song. I was just listening to so I want to go back Well random you would figure that I can't do that. Well, luckily, you know with this version Let me actually clear this out and run it again With this version right here if I really liked Track 3 and I moved to track 36 out, but I really liked track 3 So I want to go back and I want to hear it again Guess what? I can do that now that I have this kind of shuffled array and again I can use this shuffled array right here to do that now. What am I doing? Each element I'm going through each element in just like with a linear search instead of me Comparing if my linear search just to even kind of put that on the screen In my linear search, I had an index and I would take my Element at that index and compare it to a key instead of doing that What I'm doing is I'm saying create a random index and then whatever's in my current in my current I My current index take these two numbers and Swap them. That's it. So I'm going through and literally instead of this three We can think of it in the sense of I randomly generated a number. So I randomly generated the index Three why not? So I go all right. Well, where's three? This is zero one two three Okay, well this guy and this guy just so we can see the code for a second I say make randoms. I've made the randomly generated three That's a terrible three, but that I'm going to store temp Well list I I'm going to store that in temp. So temp now is going to equal Six it's hanging out there because then I say right here List at I is now going to equal list at random in so this suddenly is No longer six. It is now I have nine. There's now nine Okay, well that last little bit was list at random Randomly generated index is now equal to temp again temp is six. So guess what nine? magically becomes six That entire process gets repeated over and over again So even though I just did it here with this element. I only did it once I do it again here I do it again here. I do it again here. I do it again here here here and Here until they're all completely shuffled and that's what I get when I run through this