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
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |