Wednesday, December 22, 2010
This is a news website article about a scientific finding | Martin Robbins | Science | guardian.co.uk
A humorous take on the traditional news article about a scientific find.
Posted by
Brad D.
Friday, December 10, 2010
The Funny Farting Fanny Bank
A funny thing happened to me the other day while browsing through a catalog waiting for my meeting to start...
Modify Subscription Options
Posted by
Brad D.
Thursday, October 21, 2010
Atheism Humor: Seriously, a Religion? | PurpleSlinky
From: The Daily Joke: Did you hear about the dyslexic agnostic insomniac? He was lying awake all night wondering if there was really a Dog.<BR><BR>How many atheists did it take to fix the light bulb? Two, one to change the bulb and another to videotape the job so that others would not claim that it was Gods doing.<P><A HREF="http:
Modify Subscription Options
Posted by
Brad D.
Tuesday, September 28, 2010
Atheism Humor: Seriously, a Religion? | PurpleSlinky
Did you hear about the dyslexic agnostic insomniac? He was lying awake all night wondering if there was really a Dog.
How many atheists did it take to fix the light bulb? Two, one to change the bulb and another to videotape the job so that others would not claim that it was Gods doing.
Modify Subscription Options
Posted by
Brad D.
Friday, August 13, 2010
Monday, October 19, 2009
These are the things you don\'t say to your wife Recommended Video - BWebcentral
Seen it on facebook, I thought it was pretty funny
A parody of a popular song, and a good lesson for newbie husbands ;-)
Posted by
Brad D.
Monday, September 7, 2009
I'm not a math geek but...
Filed under Code monkey
I orginally found this post at at: http://blog.mogrify.org/2007/03/08/im-not-a-math-geek-but/
but for some reason it's now showing "Page Not Found". If anyone knows where the orginal article now resides please let me know and I'll link to it properly.
It was an interesting study of random numbers in javascript:
I'm not a math geek, but occasionally something peeks my interest. Today I was trying to work out a good way to do something randomly about once every nine or ten times. I decided to check the last digit of the return value of Javascript's Math.random() function, which returns a number between 0 and 1. Like this: 0.1809368982206232 I knew it would never be zero, since the trailing zero would be removed; so I figured I could pick any other digit and I'd be right about once every nine times. Turns out it doesn't work like that. The frequency distribution of the last digit is uneven.
Example Code:
for (var num=1; num<=9; num++) {
var match = 0; var re = new RegExp(num+'$');
for (var i=0; i<10000; i++) {
if (re.test(Math.random())) {
match++;
}
} document.write("" + num + ": " + (match/i*100+'').substring(0,5) + "%");
}
This script calls Math.random() 10,000 times for each digit from 1 to 9. It prints the last digit match rate as a percentage. Its output looks like this:
1: 8.790% 2: 10.4% 3: 12.19% 4: 13.17% 5: 13% 6: 12.95% 7: 11.51% 8: 9.35% 9: 8.58%
You'd expect something around 11.11% (one of nine) for each digit; but you can see that the frequency increases until 4, and then decreases again. In fact, this looks a heck of a lot like a bell curve, ergo, a Gaussian distribution.
I found that if I check the first digit after the decimal point, I get what I'm expecting: a list of roughly equal values somewhere around 11.11% for each digit. So although the output of Math.random() is uniformly distributed, the last digits are normally distributed.
I can't grok this much further than that; perhaps it's got something to do with the way the numbers are generated, or maybe that's just The Way Things Are. If anyone can explain to me why this happens, leave a note. Maybe I'll go poke around in the Gecko source code or something.
Posted by
Brad D.
Labels: algorithm, javascript, math, random number generator