O'Reilly logo

Programming Pearls, Second Edition by Jon Bentley

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Column 12: A Sample Problem

Small computer programs are often educational and entertaining. This column tells the story of a tiny program that, in addition to those qualities, proved useful to a company.

12.1 The Problem

It was the early 1980’s, and the company had just purchased their first personal computers. After I got their primary system up and running, I encouraged people to keep an eye open for tasks around the office that could be done by a program. The firm’s business was public opinion polling, and an alert employee suggested automating the task of drawing a random sample from a printed list of precincts. Because doing the job by hand required a boring hour with a table of random numbers, she proposed the following program.

The input ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required