Skip Menu |

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

Report information
The Basics
Id: 128172
Status: new
Priority: 0/
Queue: Scalar-List-Utils

People
Owner: Nobody in particular
Requestors: rvtol [...] isolution.nl
Cc:
AdminCc:

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



Subject: optimize shuffle / sample
Date: Sat, 5 Jan 2019 12:07:26 +0100
To: bug-Scalar-List-Utils [...] rt.cpan.org
From: "Ruud H.G. van Tol" <rvtol [...] isolution.nl>
See also the recent comment on https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle#The_modern_algorithm -- No exchange is needed if i == j. -- A single draw of n*(n-1) random bits is sufficient, -- as each step only needs to sum (n - i - 1) of them. Maybe implement an irand(N), that draws N-1 random bits and sums them. -- Ruud