NAME Array::Pick::Scan - Pick random items from an array (or iterator), without duplicates VERSION This document describes version 0.003 of Array::Pick::Scan (from Perl distribution Array-Pick-Scan), released on 2022-05-20. SYNOPSIS use Array::Pick::Scan qw(random_item); my $item = random_item(\@ary); my @items = random_line(\@ary, 3); or: my $item = random_item(\&iterator); my @items = random_line(\&iterator, 3); DESCRIPTION This module can return random items from an array (or iterator), without duplicates. It uses the same algorithm as File::Random::Pick, which in turn uses a slightly modified version of algorithm described in perlfaq ("perldoc -q "random line"")), but uses items from an array/iterator instead of lines from a file(handle). Performance-wise, this module is inferior to List::Util's "shuffle" or List::MoreUtils's "samples", but can be useful in cases where you have an iterator and do not want to put all the iterator's items into memory first. FUNCTIONS random_item Usage: my @items = random_item(\@ary [ , $num_samples ]); my @items = random_item(\&iterator [ , $num_samples ]); Number of samples defaults to 1. HOMEPAGE Please visit the project's homepage at . SOURCE Source repository is at . SEE ALSO File::Random::Pick List::Util's "shuffle" List::MoreUtils's "samples" AUTHOR perlancar CONTRIBUTING To contribute, you can send patches by email/via RT, or send pull requests on GitHub. Most of the time, you don't need to build the distribution yourself. You can simply modify the code, then test via: % prove -l If you want to build the distribution (e.g. to try to install it locally on your system), you can install Dist::Zilla, Dist::Zilla::PluginBundle::Author::PERLANCAR, and sometimes one or two other Dist::Zilla plugin and/or Pod::Weaver::Plugin. Any additional steps required beyond that are considered a bug and can be reported to me. COPYRIGHT AND LICENSE This software is copyright (c) 2022, 2020 by perlancar . This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. BUGS Please report any bugs or feature requests on the bugtracker website 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.