in reply to Guess A Number

A side note (since the expected range of randam number is missing or i have missed it)...

my $answer = int(rand($max)) + 1;

...$answer lies in [1,$max], and w/ this...

my $answer = int(rand($max + 1));

...produces $answer in [0,$max]. (Just thinking outloud.)

Duplicate: Ah crap! The similar post above should not have been there. Please ignore that.

Replies are listed 'Best First'.
Re: Re: Guess A Number
by sulfericacid (Deacon) on Mar 18, 2003 at 04:35 UTC
    This message kind of confuses me, too many variables and things to think about in the lines, lol. I believe I did test my version of int(rand($max)) + 1); with a range of 10 and it did randomly generate the top number (10) atleast once. I will check again just to be sure though.

    Thanks.

    "Age is nothing more than an inaccurate number bestowed upon us at birth as just another means for others to judge and classify us"

    sulfericacid