Perl-Sensitive Sunglasses | |
PerlMonks |
Bug in List::Util::shuffle ?by matija (Priest) |
on Dec 06, 2008 at 14:44 UTC ( [id://728554]=perlquestion: print w/replies, xml ) | Need Help?? |
matija has asked for the wisdom of the Perl Monks concerning the following question: I'm working on a project which uses TheSchwartz, and I saw that it was supposed to work with multiple databases. I was not sure how it would maintain some of it's stuff over more than one database, so I tested it - and found that all the stuff kept going to the same database server. I looked at the source, and found that it's routine for shuffling databases uses Util::List, and so I tested it: That gave me:
1,2,3,4,5,6,7,8,9,10
The shuffle routine in List::Util looks reasonable at first glance:
1,2,3,4,5,6,7,8,9,10 1,2,3,4,5,6,7,8,9,10 1,2,3,4,5,6,7,8,9,10 1,2,3,4,5,6,7,8,9,10 1,2,3,4,5,6,7,8,9,10 1,2,3,4,5,6,7,8,9,10 1,2,3,4,5,6,7,8,9,10 1,2,3,4,5,6,7,8,9,10 1,2,3,4,5,6,7,8,9,10 1,2,3,4,5,6,7,8,9,10 1,2,3,4,5,6,7,8,9,10 1,2,3,4,5,6,7,8,9,10 1,2,3,4,5,6,7,8,9,10 1,2,3,4,5,6,7,8,9,10 1,2,3,4,5,6,7,8,9,10 1,2,3,4,5,6,7,8,9,10 1,2,3,4,5,6,7,8,9,10 1,2,3,4,5,6,7,8,9,10 1,2,3,4,5,6,7,8,9,10 1,2,3,4,5,6,7,8,9,10 1,2,3,4,5,6,7,8,9,10 1,2,3,4,5,6,7,8,9,10 1,2,3,4,5,6,7,8,9,10 Personally, I'm never comfortable using floating point values for array indices, but perhaps there's a perl magic at work that I don't understand. At any rate, either there's a bug in shuffle, or something is very wrong with my random generator - or am I, along with the author of TheSchwartz using List::Util::shuffle incorrectly?
Back to
Seekers of Perl Wisdom
|
|