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 6, 2001 09:36
Subject:
Re: [ID 20010305.005] "use integer" doesn't make rand() return integers
Message ID:
3AA52DE1.20059.202520B@localhost
On 6 Mar 2001, at 9:42, John Peacock wrote:

> abigail@foad.org wrote:
> > Having said that, having 'rand' returning integers when 'use integer'
> > is in effect fits exactly in Perls DWIM nature.
> 
> 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 believe Abigail was talking about rand the function, not rand() the 
function called with zero arguments -- specifically, about the output of 
rand( $x ) under 'use integer' for some number $x. Which would 
probably answer your question about the range to use.

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