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:
Tony Finch
Date:
March 6, 2001 11:31
Subject:
Re: [ID 20010305.005] "use integer" doesn't make rand() return integers
Message ID:
20010306184529.J412@hand.dotat.at
John Peacock <jpeacock@rowman.com> wrote:
>abigail@foad.org wrote:
>> 
>> Having said that, having 'rand' returning integers when 'use integer'
>> is in effect fits exactly in Perls DWIM nature.

This was why I submitted the bug report.

>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.

Tony.
-- 
f.a.n.finch      fanf@covalent.net      dot@dotat.at
"I never wanted to be a weather forecaster -- I wanted to be... a lumberjack!
Leaping from tree to tree as they float down the mighty rivers of British
Columbia! The giant redwood! The larch! The The mighty scots pine! ..."

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