Skip Menu |
 

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

Report information
The Basics
Id: 105275
Status: resolved
Priority: 0/
Queue: Scalar-List-Utils

People
Owner: Nobody in particular
Requestors: blue [...] thisisnotmyrealemail.com
Cc:
AdminCc:

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



Subject: new function suggestion - sample($k, @list)
MIME-Version: 1.0
X-Mailer: MIME-tools 5.504 (Entity 5.504)
Content-Disposition: inline
X-RT-Interface: Web
Message-ID: <rt-4.0.18-30418-1434491139-1949.0-0-0 [...] rt.cpan.org>
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
X-RT-Encrypt: 0
X-RT-Sign: 0
Content-Length: 676
Download (untitled) / with headers
text/plain 676b
Repeating a github issue because it looks like nobody is a member of the github group Scalar-List-Utils, so not sure if anybody gets notified of new issues. From https://github.com/Scalar-List-Utils/Scalar-List-Utils/issues/25 I frequently find myself in need of getting k random elements from a list of size n. To do this, I shuffle the list and take a slice of size k. But it would be more efficient when n is large to implement this as a truncated shuffle, so you can stop the shuffle algorithm after k steps. I would have proposed this for List::MoreUtils, but it might be better off in the same module as shuffle, especially if they can share the same XS implementation
MIME-Version: 1.0
In-Reply-To: <rt-4.0.18-30418-1434491139-1949.0-0-0 [...] rt.cpan.org>
X-Mailer: MIME-tools 5.504 (Entity 5.504)
Content-Disposition: inline
X-RT-Interface: Web
References: <rt-4.0.18-30418-1434491139-1949.0-0-0 [...] rt.cpan.org>
Content-Type: text/plain; charset="utf-8"
Message-ID: <rt-4.0.18-17551-1439445540-1730.105275-0-0 [...] rt.cpan.org>
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
X-RT-Encrypt: 0
X-RT-Sign: 0
Content-Length: 313
Download (untitled) / with headers
text/plain 313b
There're members, but Ticket's shall be sent to https://rt.cpan.org/Dist/Display.html?Name=Scalar-List-Utils - please respect the choosen ticket URL, if you want to be heared. Maybe a working e-Mail address is an option, either. However - provide a nice Perl and XS implementation, suitable tests and I merge it.
MIME-Version: 1.0
In-Reply-To: <rt-4.0.18-30418-1434491139-1949.0-0-0 [...] rt.cpan.org>
X-Mailer: MIME-tools 5.504 (Entity 5.504)
Content-Disposition: inline
X-RT-Interface: Web
References: <rt-4.0.18-30418-1434491139-1949.0-0-0 [...] rt.cpan.org>
Content-Type: text/plain; charset="utf-8"
Message-ID: <rt-4.0.18-17390-1580950444-213.105275-0-0 [...] rt.cpan.org>
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
X-RT-Encrypt: 0
X-RT-Sign: 0
Content-Length: 63
A function exactly like this was added in 1.54 -- Paul Evans


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

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.