I’ve been busy recently. Not really doing much other than this new project that I’ve been assigned. Since the nature of the project is somewhat hush with a little more hush involved, I’m not exactly sure what or how much I can talk about it. So, I’ll not mention the why, or the how right now (although it is would make a pretty excellent entry if I could) but I think I can go into the what.
Basically, I had to create some programs that do very explicit things. One of those things was to create a function that could shuffle up a standard deck of cards. One of the way that you could do that would be to use the “Random” function that almost every programming language anywhere has. These “Random” functions will usually seed their numbers with something like the milliseconds on the system clock. The problem with that is that languages are fast, really really fast. So if you were to have the system make “random” numbers with the “Random” function using the system clock, the numbers would probably look like this : 1,1,1,2,2,3,3,3,4,5,6,6,6,7,7,7…which is why I keep using the little “”‘s around the word “Random.”
No, to really get the things really properly shuffled I had to think of something else and it came to me while I was playing Magic. Oh, yeah, that game. So I was shuffling up and thinking. You see, in the system cards would be stored in a table with 52 cells in it. My Magic deck had around 40, but the principal is still the same. Visualize shuffling cards for a moment, but really slow. What you’re doing is splitting them into piles and the adding them to each other by alternating the cards. So if you had 6 cards you would split them in half like this :
1,2,3 and 4,5,6
When you shuffle them you should then get this as the new order:
This looks more random, but since we know what we started with then all we really did was create a new pattern. We could probably express this new pattern with an equation, which doesn’t really strike me as truly randomized.
I know, I know, why not just shuffle more times? Well, that’s the thing. I looked up shuffling and that particular kind of shuffle returns itself to the original setting in n shuffles where n is the number of cards in the deck. That means that every single variation of that deck could be expressed and calculated in advance.
So I got to thinking, “What if,” I asked myself, “I didn’t just do 2 piles? What if I broke the deck into quarters and shuffled those together?” This led me to my solution, which was to do exactly that, and the use the “Random” generator to select which decks to mix together. Since the decks that were actually shuffled together would change every time I did it, and then do that a random number of times the results that I finally got were truly random. The odds of getting the exact same distribution of cards using this method is 52 to the 52nd power. Considering that there are only 10 to the 23rd power stars in the universe that’s a damn lot of randomly selected variations.
With that out of the way I then had to use that to create a small program that plays
Long story short, it works now. I even got the tricky bit involving a soft <message redacted> to work correctly, and the variable nature of <message redacted> to work as well using a system of counters that keep track of things for the different players. I may eventually post my sweet <message redacted> program somewhere to show my coding prowess, but I think that the fine people at <message redacted…Hard> may think that I am sharing some kind of secret process to my legions of readers (Ha!).
-We should return to our regularly scheduled nonsense soon, once I get this hotness to its rightful place in the universe.
-The titles have almost nothing to do with the content today. Oh, there is so a reason that I call them that, other than the one I’m not about to share (state secrets, MIBs, a secret briefcase and all). Actually the Wife had picked up on of those butterfly habitats and we are watching the butterflies go through their adorable life processes. As of today they are coming out and looking all, butterfly-ish. Except for one of them anyway who came out with a weird wing. We call him Lucky, on account of his lucky wing. Oh, and he flies like a drunk. It’s adorable, and I get the impression that we’re going to end up keeping him.
Gotta catch ’em all.