in reply to Random numbers generation
Greetings Fellow Monk!
Here is yet another way to do what you are asking for using the CPAN Module Math::Random.
$low is the lower limit, $high is the upper limit, and
@array is the array containing your random numbers as specified by your lower and upper limits.
The beauty of Perl, The Perl Community, and CPAN is that there is usually a module out there that will do just about anything you are looking for often times significantly reducing the amount of code you need to write.
Here is yet another way to do what you are asking for using the CPAN Module Math::Random.
$n is the number of random numbers you wish to generate,#!/usr/bin/perl -w use strict; use Math::Random; my($n,$low,$high)=(100,250,500); my @array=random_uniform_integer($n,$low,$high); for(my $i=0; $i<$n; $i++){print "$array[$i]\n";}
$low is the lower limit, $high is the upper limit, and
@array is the array containing your random numbers as specified by your lower and upper limits.
The beauty of Perl, The Perl Community, and CPAN is that there is usually a module out there that will do just about anything you are looking for often times significantly reducing the amount of code you need to write.
|
---|
In Section
Seekers of Perl Wisdom