House Cleanup

Crystal has four consecutive days off this week. I took today off to spend it with her and Henry. We got up and went to the store and got stuff for tacos. We bought a bookcase which has really helped spread our books out. I don’t think we have too many books but the one shelf was becoming over flowed especially since we also have some knick-knacks on them. Crystal and I got really motivated and cleaned our kitchen, living room, and bedroom. We got around to the several chores we had neglected and tasks we had put aside like hanging some plates and finally sorting through old papers.

We also decided it was time to replace our ten year old 22″ TV. We are thinking about going with the LG 32LC7D 32″ LCD HDTV. I finally got the entertainment area cleaned up and things organized so it doesn’t look so cluttered. It will sure be nice to not have to squint to watch movies and play games. We are also considering a larger model so we can take advantage of 1080i/p. Anyway, we’ll probably be acquiring one soon.

Finally, thanks to Tim for his help, I found and fixed a bug in a function that creates a 32 character “guid”. This unique id was generated using PHP’s microtime function as the seed for the mt_rand function. I thought that by using so many characters it would create a 208 bit unique id but I was wrong! It turns out that the function doesn’t return just Unix time but a sort of fraction before it. So I was actually only getting 0-9999 possibilities for the seed. In 100,000 transactions, the same 208 bit key appeared 5 times which has a 0.005% chance of occurring.

Instead, we decided to go with the actual Unix time, IP address, and a few other data; hashing them and then using the hash to grab the character from the pattern. This seems much more able to generate truly unique IDs. Randomness is truly not random at all. I suppose I am surprised that this occurred with using something like the Mersenne Twister for determining the random number. I suppose with programming randomness is all related to clock cycles, the seed, and other less random variables. Interesting stuff indeed and I, quite frankly, don’t know enough to make a call on whether or not to use it except that from things I have read indicated to me that the chances of duplicating a 208 bit string should have been much, much smaller.

This entry was posted in Uncategorized. Bookmark the permalink.

Comments are closed.