Archive for March 18, 2011

Friday, March 18, 2011 [Tweets] [Favorites]

Random Numbers

Mike Ash:

Our “random” index is twice as likely to fall within the first half of the array as the second half. As the desired range shrinks, this problem likewise shrinks, but it still exists for any desired range which can’t evenly divide the original range.

The solution to this is to use as much as possible of the original range, and discard the number and try a new one if it falls outside what’s usable.

This is such a common issue that I wonder why there isn’t a solution in the standard library.

Ingredients 1.0

Craig Hockenberry on Xcode 4 and the new Ingredients documentation viewer:

Ingredients parses the HTML files used by Apple’s own viewer and persists the information with Core Data. The result is quick access to the documentation you need with advanced options to filter and sort to your liking. Recent work by Troy Gaul added an item to the Services menu so a keyboard shortcut can be created to view the selected symbol from any text editor (include Xcode.)

I’ve almost always used a Web browser and the header files, rather than Xcode’s built-in documentation viewer. Does anyone like the pop-ups?

The Story of Oregon Trail

Jessica Lussenhop (via Jason Kottke):

FORTY YEARS AND TEN iterations later, the Oregon Trail has sold over 65 million copies worldwide, becoming the most widely distributed educational game of all time. Market research done in 2006 found that almost 45 percent of parents with young children knew Oregon Trail, despite the fact that it largely disappeared from the market in the late ’90s.

I believe I first played it on an Apple IIe, which was challenging due to the linear arrow key arrangment.