WordListRole::RandomSeekPick - Provide a pick() implementation that random-seeks DATA
This document describes version 0.004 of WordListRole::RandomSeekPick (from Perl distribution WordListRole-RandomSeekPick), released on 2020-05-23.
The default WordList's pick() performs a scan on the whole word list once while collecting random items. This role provides an alternative implementation that random-seeks on DATA, discard the line fragment, then get the next line. This algorithm does not provide uniformly random picking, but for many cases it should be random enough. It is faster if you have a huge word list and just want to pick one or a few items.
Note: since this role's pick() operates on the DATA filehandle directly instead of using each_word(), it cannot be used on dynamic wordlists.
Please visit the project's homepage at https://metacpan.org/release/WordListRole-RandomSeekPick.
Source repository is at https://github.com/perlancar/perl-WordListRole-RandomSeekPick.
Please report any bugs or feature requests on the bugtracker website https://rt.cpan.org/Public/Dist/Display.html?Name=WordListRole-RandomSeekPick
When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.
File::RandomLine provides a similar algorithm.
This software is copyright (c) 2020 by email@example.com.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install WordListRole::RandomSeekPick, copy and paste the appropriate command in to your terminal.
perl -MCPAN -e shell
For more information on module installation, please visit the detailed CPAN module installation guide.