Sat Jan 05 06:07:48 2019rvtol [...] isolution.nl - Ticket created
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