Mohammad K Jilani wrote at Wed, 17 Jul 2002 18:15:17 +0200:
> How can I generate a whole number betwee 10 - 99?
>
Another cool way,
where I don't need to think,
is using the String::Random module:
use String::Random qw/random_string/;
print random_string "0n", [1..9];
or perhaps more readable
On Wednesday, July 17, 2002, at 09:29 , Nikola Janceski wrote:
> you for got the int.. he said whole numbers
>
> my $rand_num = int(rand(90) + 10);
>
good point! I had forgotten to be explicit
that we wanted an int...
eg:
my $int = 10;
my $count = rand($int) + $int;
On Jul 17, Jilani, Mohammad K said:
>How can I generate a whole number betwee 10 - 99?
Well, using int(rand(10)) gives you an integer from 0 to 9. If you add 10
to it, you get an integer from 10 to 19.
To get an integer from 10 to 99, you need to come up with an expression of
the form
X + i
you for got the int.. he said whole numbers
my $rand_num = int(rand(90) + 10);
> -Original Message-
> From: drieux [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, July 17, 2002 12:25 PM
> To: begin begin
> Subject: Re: Random generator
>
>
>
> On Wednesd
On Wednesday, July 17, 2002, at 09:15 , Jilani, Mohammad K wrote:
> How can I generate a whole number betwee 10 - 99?
>
perldoc -f rand
and then tweek it
since rand runs from 0 you might try say
my $rand_num = rand(90) + 10;
ciao
drieux
---
--
To unsubscribe, e-mail: [EMAIL PR
How can I generate a whole number betwee 10 - 99?
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--
This message is intended only for the personal and confidential use of