Random numbers can be generated using rand() function (see rand). This short script below prints 5 random numbers between 1 and 50. The group of numbers is sorted.
#!/usr/bin/perl -w use strict; my %num; while ((keys %num) < 5) { $num{int(rand(50)+1)} = 1; } print join(' ' , sort {$a <=> $b} keys %num) . "\n";
In reply to Re: Generate a # between 1 and 50 in groups of 5
by pme
in thread Generate a # between 1 and 50 in groups of 5
by Hayest
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |