LMPX.COM |
Home | Linux | Mysql | PHP | XML | ||
|
|
|||
From: comdog@cvs.perl.org Date: Tue Aug 12 14:44:10 2008 Subject: [svn:perlfaq] r11641 - perlfaq/trunk
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 <>;
| Navigate in group perl.cvs.perlfaq at sever nntp.perl.org | |
| Previous | Next |
| © No Copyright You are free to use Anything |
Site Maintained by PHP Developer
Powered By PHP Consultants |