Drink Tank

Extra Aqua Vitae Nulla Salus

10.03.2005

"Random" Article of the Day

I was JUST pondering this very problem today. I need to write a random LETTER generator (for English), and it is not as simple as it sounds. Luckily, there is no need to wade through English letter frequency distribution tables because the folks at Hasbro have already graced the world with the fruit of their R&D lab's tireless effort. But, as this article illustrates, you can see what happens when you pit a retired geologist against electronic travel Scrabble(tm).

First person to post a comment with the fastest (and least memory consuming) way of generating a random letter in C according to official Scrabble distribution wins some hard-earned Drink Tank street cred.

Now, if we really want it to be random, it might get a bit more complicated. Google turned up a straightforward explanation of the problem with PRNGs, or pseudo-random number generators, which are used in every operating system on the planet. For our random letter generator we need to break out the big (random) guns. Go Wolfram!

4 Comments:

At 12:46 PM, Blogger oded said...

that page said that j is used slightly less then x which seems wrong to me

 
At 1:17 PM, Blogger Ivan said...

Axe and Ox are easy.

 
At 1:38 PM, Blogger Ivan said...

trye this, which get's an vowels per initial hand of 3.08. I'm not sure what's wrong with it :)

 
At 2:37 PM, Blogger Ivan said...

Whoops. Y isn't a vowel :). I updated the link above.

It takes .375 seconds to calculate 100,000 initial hands on my machine. The footprint is pretty small. Less than a K is looks like.

 

Post a Comment

<< Home