G'day hippo,

++ Thanks for checking that out. I ran a verbatim copy of your one-liner four times and got a different result each time; so, on the face of it, this seems to be working correctly (with v1.62 & v1.63).

I did actually sit down to run some tests yesterday; unfortunately, real-life barged in and the testing needed to take a backseat. I will get to it eventually.

I'm fairly certain that I didn't change any logic when moving from sample to shuffle. I recall only a very minor modification; probably just these two lines (off the top of my head):

#use List::Util 'sample'; use List::Util 'shuffle'; ... #my @playlist = sample $list_length, @all_files; my @playlist = (shuffle @all_files)[0 .. $list_length - 1];

I'll post more when I get to the testing. It's 11pm here now, so that won't be tonight. :-)

— Ken


In reply to Re^5: Add a fixed number of unique elements to hash [sample() vs. shuffle()] by kcott
in thread Add a fixed number of unique elements to hash by Vasek

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.