Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??

That doesn't guarantee unique values. With the built-in rand/srand, it produces repeats within 30 picks for seeds:

seed : no.of picks before repeat 89 : 12 178 : 17 485 : 9 504 : 14 555 : 22 662 : 16 688 : 23 761 : 19 766 : 18 920 : 26 936 : 25 943 : 19 955 : 17 982 : 14 1004 : 27 1032 : 19 1192 : 23 1200 : 9 1385 : 24 1427 : 17 1439 : 29 1459 : 22 1582 : 14 1593 : 22 1602 : 29 1668 : 12 1737 : 22 1924 : 29 1933 : 24 1969 : 18 2186 : 27 2261 : 12 2297 : 12 2380 : 18 2410 : 29 2660 : 25 2690 : 28 2733 : 24 2817 : 13 2863 : 4 2875 : 19 2964 : 28 3023 : 27 3052 : 9 3198 : 24 3208 : 23 3240 : 28 3292 : 16 3415 : 2 3529 : 26 3669 : 22 3692 : 29 3741 : 21 3754 : 13 3791 : 23 3805 : 28 3842 : 24 3854 : 8 3956 : 28 4077 : 27 4202 : 20 -- More --

Testcase:

#! perl -slw use strict; for my $i ( 1 .. 100000 ) { my %hash; srand $i; ++$hash{ int rand 100000 } == 2 and print "$i : ", scalar keys %ha +sh while keys %hash < 30; }

With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

In reply to Re^2: Non-Repetitive Random Numbers by BrowserUk
in thread Non-Repetitive Random Numbers by Anonymous Monk

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!
  • 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, 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, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            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.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others avoiding work at the Monastery: (15)
    As of 2014-09-30 15:36 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      How do you remember the number of days in each month?











      Results (376 votes), past polls