Skip Menu |

This queue is for tickets about the Scalar-List-Utils CPAN distribution.

Report information
The Basics
Id: 120798
Status: open
Priority: 0/
Queue: Scalar-List-Utils

Owner: Nobody in particular
Requestors: zaxon [...]

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: 1.54

Subject: request: roll function similar to that of perl6
Download (untitled) / with headers
text/plain 136b
Perl6's roll() function would be a good complement to the pick() function in git:
1.54 added "sample" which handles this -- Paul Evans
Download (untitled) / with headers
text/plain 571b
On Wed Feb 05 19:50:41 2020, PEVANS wrote: Show quoted text
> 1.54 added "sample" which handles this
it was already pointed out in the mentioned ticket that the behaviors of pick() and roll() are different: perl6's roll() is similar to your implementation of sample(), but it is different from perl6's pick(): if a user wanted to emulate pick(), they'd have to call sample(1, @a) multiple times, which isn't any better than calling `map { $a[rand @a] } 1..$n`.

This service is sponsored and maintained by Best Practical Solutions and runs on infrastructure.

Please report any issues with to