develooper Front page | perl.perl5.porters | Postings from March 2001

Re: [ID 20010305.005] "use integer" doesn't make rand() return integers

Thread Previous | Thread Next
From:
Philip Newton
Date:
March 7, 2001 01:57
Subject:
Re: [ID 20010305.005] "use integer" doesn't make rand() return integers
Message ID:
3AA6141A.16024.727120@localhost
On 6 Mar 2001, at 18:45, Tony Finch wrote:

> John Peacock <jpeacock@rowman.com> wrote:
> 
> >I agree that it does fit DWIM, but since rand() returns a float between 
> >0 and 0.999999999, what would the corresponding integer range be:  
> >0-10, 0-100, 0-1000???  I think this is one of those cases where the 
> >user has to make that determination for themselves.
> 
> I suggest 0..1.

I suggest [0, 1). (I hope I got the notation right: I mean { x | 0 <= x 
< 1 } .)

Cheers,
Philip
-- 
Philip Newton <pnewton@gmx.de>
I appreciate copies of replies to my messages to Perl5 lists.

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About