[svn:perlfaq] r11641 - perlfaq/trunk
[email protected] Tue, 12 Aug 2008 13:44:10 -0700 (PDT)
| Newsgroups | perl.cvs.perlfaq |
|---|---|
| Message-ID | <[email protected]> |
Author: comdog Date: Tue Aug 12 13:44:10 2008 New Revision: 11641 Modified: perlfaq/trunk/perlfaq5.pod Log: * perlfaq5: How do I select a random line from a file? + typo fix. no big whoop. Modified: perlfaq/trunk/perlfaq5.pod ============================================================================== --- perlfaq/trunk/perlfaq5.pod (original) +++ perlfaq/trunk/perlfaq5.pod Tue Aug 12 13:44:10 2008 @@ -1301,7 +1301,7 @@ Short of loading the file into a database or pre-indexing the lines in the file, there are a couple of things that you can do. -Here's a resevoir-sampling algorithm from the Camel Book: +Here's a reservoir-sampling algorithm from the Camel Book: srand; rand($.) < 1 && ($line = $_) while <>;