I would like to point out that the numbers aren't as random as they could be. int(rand(1)) will always produce 0 as the output. int(rand(2)) will produce 0 or 1, int(rand(3)) will produce 0, 1 or 2 and so on. If you would like to produce multiple random numbers that are between 1 0 and 99 then try this.

use strict; use warnings; my @a; foreach my $upper (1..10) { @a = map { int rand $upper } 1..10; print "@a\n"; } print '*'x79, "\n"; foreach my $upper (1..10) { @a = map { int rand 100 } 1..10; printf "%2s ", $_ foreach @a; print "\n"; } __END__ 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 1 1 1 1 1 2 0 0 2 1 1 1 0 2 1 1 0 0 0 3 0 1 0 0 2 2 2 1 1 4 1 3 4 2 0 4 3 3 2 0 4 5 1 2 3 0 0 5 5 2 6 5 1 1 6 1 4 7 5 2 0 2 3 6 7 7 4 0 4 4 8 2 2 1 1 8 9 2 9 7 6 0 7 1 4 ********************************************************************** +********* 15 38 19 5 43 30 71 4 55 44 12 62 64 68 38 3 76 68 61 41 11 60 88 46 80 89 20 45 78 99 91 57 58 16 93 75 69 98 90 81 87 61 42 72 47 16 19 19 97 16 51 99 89 12 86 53 58 71 52 99 31 1 36 27 85 56 90 88 69 92 82 6 86 59 88 66 88 50 42 58 23 54 96 52 61 39 82 65 62 6 7 92 77 22 78 91 6 63 67 22

In reply to Re: one line to check for common list values by Lotus1
in thread one line to check for common list values by dollar_sign

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.